blog.robotex.de

Using factory girl in your rails projects

Install Factory Girl:

$> gem install factory_girl_rails

Add factory girl to your Rails.root/Gemfile:

group :test do
  gem "factory_girl_rails"
end

Install your bundle:

$> bundle install

If you use rspec2, put your factories in Rails.root/spec/factories.rb:

Factory.define :admin do |admin|
  admin.email    "admin@example.com"
  admin.password "foobar"
end

Back