Undefined `FactoryGirl 'method - upgrade from 2.0.2 to 3.4.2

I am in the process of upgrading from factory_girl (2.0.2 to 3.4.2) and factory_girl_rails (1.1.0 → 3.4.0) and I am having problems with my rspec checks, watching the factory girl.

I think that I have successfully modified my factories to deal with the new syntax, and removed unnecessary claim statements that resulted in multiple copies of the same files. Now my server is starting up, so I know that the factories.rb file is being processed correctly.

Now when I run my rspec tests, I get this error:

NoMethodError: undefined `FactoryGirl 'method for #

it 'can be created' do
  course = FactoryGirl(:course)
  ….
end
+5
source share
1 answer

With Factory Girl 3.4.2, you will need to explicitly use the create method.

course = FactoryGirl.create(:course)
+15

All Articles