I am trying to use Factory Girl for RSpec with Spork. Whenever I run my tests without spork, everything passes, but when I run it with Spork, all tests that try to create a Factory instance that depends on another factory fail. For instance:
3) Invitation has a correctly formed body Failure/Error: request = FactoryGirl.create(:request, ....) NoMethodError: undefined method `user=' for #<Request:0x007f86b6a87890>
And my factories.rb code looks something like this:
FactoryGirl.define do factory :user do sequence(:first_name) { |n| "first_name#{n}" } sequence(:last_name) { |n| "last_name#{n}" } end factory :request do association :user, :factory => :user, :is_walker => false end end
My code only seems broken when there is a connection, and then it tries to call setter on :user . Why can this happen?
Here are the versions I use
gem 'rails', '3.0.7' gem 'rspec-rails', '2.6.1' gem 'spork', '0.9.0.rc5' gem 'factory_girl_rails', '1.0'
source share