github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mdarby / sweatshop

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 14
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Rails plugin that generates factory_girl Factories for all ActiveRecord models — Read more

  cancel

http://blog.matt-darby.com

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Serialized fields will have be assigned an empty hash instead of 'foo' 
aqab (author)
Wed Dec 23 05:30:53 -0800 2009
mdarby (committer)
Wed Dec 23 06:03:50 -0800 2009
commit  f39f326ed8412bfb849d3bb4fd272e81d2268e4a
tree    8d7ec52d714adf189ee91b160440c5efc511e004
parent  4a1e250c1278daff0111f0e39e4e41b505eff28e
sweatshop /
name age
history
message
file MIT-LICENSE Sun Oct 19 20:13:12 -0700 2008 I present Sweatshop [mdarby]
file README.textile Mon Oct 20 05:55:09 -0700 2008 Fixed require line [mdarby]
file Rakefile Sun Oct 19 20:13:12 -0700 2008 I present Sweatshop [mdarby]
file init.rb Sun Oct 19 20:18:10 -0700 2008 Oops... [mdarby]
file install.rb Sun Oct 19 20:13:12 -0700 2008 I present Sweatshop [mdarby]
directory lib/ Sun Oct 19 20:13:12 -0700 2008 I present Sweatshop [mdarby]
directory tasks/ Wed Dec 23 06:03:50 -0800 2009 Serialized fields will have be assigned an empt... [aqab]
directory test/ Sun Oct 19 20:13:12 -0700 2008 I present Sweatshop [mdarby]
file uninstall.rb Sun Oct 19 20:13:12 -0700 2008 I present Sweatshop [mdarby]
README.textile

Sweatshop

A Rails plugin that generates factory_girl Factories for all of your ActiveRecord models.

Requirements

You should probably have the factory_girl gem installed

How to Install & Use

  1. Install the factory_girl gem
    
    gem install factory_girl
    
  1. Install the plugin
    
    ./script/plugin install git://github.com/mdarby/sweatshop.git
    
  1. Run the following rake task to generate your Factories
    
    rake sweatshop:generate
    
  1. Make sure you put the two following lines into spec/spec_helper.rb:
    
    require 'factory_girl'
    Dir.glob("#{RAILS_ROOT}/spec/factories/*.rb").each{|factory| require factory}
    
  1. Your Factories will now be automatically included whenever you run your specs.

That’s it!

Notes

I use RSpec for my BDD habit; you might use something else. Those two lines I mention above can be used in Test::Unit, I’m sure. However, it’s up to you to figure out ;)

About the Author

My name is Matt Darby. I’m a 29 year old professional Web Developer and IT Manager. I am the IT Manager and Lead Web Developer at Dynamix Engineering and recently earned a Master’s Degree in Computer Science from Franklin University in Columbus, OH.

Feel free to check out my blog or to recommend me

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server