1. Install factory_girl
sudo gem install thoughtbot-factory_girl --source="http://gems.github.com"
2. Configure
create factory.rb file in spec directory, i.e.
Factory.define :user do |u|
u.login "testing"
u.password "testing"
end
in spec_helper file add:
require 'factory_girl'
require File.expand_path(File.dirname(__FILE__) + /factory)
3. Use factory_girl
Factory(:user), Factory.build(:user)
sudo gem install thoughtbot-factory_girl --source="http://gems.github.com"
2. Configure
create factory.rb file in spec directory, i.e.
Factory.define :user do |u|
u.login "testing"
u.password "testing"
end
in spec_helper file add:
require 'factory_girl'
require File.expand_path(File.dirname(__FILE__) + /factory)
3. Use factory_girl
Factory(:user), Factory.build(:user)