psyho / bogus

Fake library for Ruby
Other
359 stars 14 forks source link

Problems with FactoryGirl/Shoulda Matchers and UndefinedReturnValue #68

Closed mattbeedle closed 9 years ago

mattbeedle commented 9 years ago

Hi,

I'm seeing intermittent UndefinedReturnValue errors. They seem to occur depending on what order the tests are run. For example:

1__matthews-macbook-pro__tmux_

On other occasions the tests fail with the same error, but from shoulda-matchers instead:

1__matthews-macbook-pro__tmux_

On very rare occasions the suite passes. There's nothing much in my bogus config:

Bogus.configure do |config|
  config.fake_ar_attributes = true
end

Any idea what's going on here?

mattbeedle commented 9 years ago

All tests pass every time when I run them individually.

mattbeedle commented 9 years ago

Solved it. The issue was that I was requiring bogus and bogus config in my spec_helper file and they needed to be required in my rails_helper, after Rails had be loaded.