Zeus + FactoryGirl::Syntax::Methods. undefined method `create'
Asked Answered
C

2

16

I have:

RSpec.configure do |config|
  config.include FactoryGirl::Syntax::Methods
end

which properly work with simple rspec spec/model/user_spec.rb (allows me to use create(:user), not FactoryGirl.create(:user)). But if I use zeus rspec spec/model/user_spec.rb to speed up my specs, it troughs me an error:

Failure/Error: @user = create(:user)
     NoMethodError:
       undefined method `create' for #<RSpec::Core::ExampleGroup::Nested_2::Nested_1:0x007fc8618e4960>

How I can use this syntax with zeus?

Cheesewood answered 13/3, 2013 at 8:59 Comment(2)
zeus rake spec works fine for me, with factory girl.Wyne
It seems to be only if run specific spec. I have updated my question.Cheesewood
B
28

Remove either of these lines in spec/spec_helper.rb if they exist:

require 'rspec/autorun'
require 'rspec/autotest'
Barbershop answered 5/4, 2013 at 0:14 Comment(2)
Do you know why this breaks FactoryGirl? This seems like a band-aid.Biblioclast
This also works for getting rspec-fire working with zeusAbroad
B
1

Did you previously use spork on this project? If so, you have to remove the parts that Spork changed in your spec_helper. Like @ilake-chang said, you have to remove the require 'rspec/autorun' and you'll also want to remove Spork.prefork and Spork.each_run.

See the Zeus wiki on Spork

Ballocks answered 21/11, 2013 at 16:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.