Making factory_girl even easier on Rails
Not that it was difficult to use with Rails, but now it’s even easier.
I present to you the-oh-so-creatively-named factory_girl_on_rails.
script/plugin install git://github.com/technicalpickles/factory_girl_on_rails.git
What it does
This plugin allows you to place factory definitions in
test/factories, and the plugin will automatically load them.
Additionally, it provides a simple generator for creating new factories:
./script/generate factory account
This creates an Account factory:
./script/generate factory post title:string body:text published:boolean
This creates a Post factory with a string title, text body, and published flag.
It lives on GitHub: technicalpickles/factory_girl_on_rails
Overall, this plugin doesn’t do a whole lot, but I had to do this kind of thing by hand on enough projects that I figured it was worth it.