Skip to content

Fixtures error when tests requiring 'spec_helper' are run alongside tests requiring 'rails_helper' #1355

@tmertens

Description

@tmertens

A failure occurs when some tests require only a very barebones spec_helper for classes that have no dependency on rails, while other tests require rails_helper if they have dependencies on the rails side of the app.

When run individually, both types of tests run fine. When run together, the spec_helper tests will raise an error. It does not appear to matter which order the tests run in.

Failure/Error: Unable to find matching line from backtrace
     NoMethodError:
       undefined method `pre_loaded_fixtures' for SomeClass
     # ruby-2.1.5@avant_basic/gems/attr_encryptor-2.0.0/lib/attr_encryptor.rb:263:in `method_missing'
     # ruby-2.1.5@avant_basic/gems/activesupport-3.2.19/lib/active_support/core_ext/class/attribute.rb:98:in `pre_loaded_fixtures'
     # ruby-2.1.5@avant_basic/gems/activerecord-3.2.19/lib/active_record/fixtures.rb:836:in `setup_fixtures'

I've traced the issue to this line: https://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/fixture_support.rb#L10

activesupport (3.2.19)
rails (3.2.19)
rspec-core (3.2.1)
rspec-expectations (3.2.0)
rspec-mocks (3.2.1)
rspec-rails (3.2.1)
rspec-support (3.2.2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions