Skip to content

Failing tests when running rspec under spring #209

@elitalon

Description

@elitalon

Hi,

I am running the following command to execute some tests:

spring rspec spec/models

and three test fails:

1) User should have secure password
     Failure/Error: it { should have_secure_password }
     NoMethodError:
       undefined method `has_secure_password?' for #<User:0x007f807da9b5c8>
     # ./spec/models/user_spec.rb:16:in `block (2 levels) in <top (required)>'

  2) User#save when email address is already taken 
     Failure/Error: it { should validate_uniqueness_of(:email) }
     NoMethodError:
       undefined method `validate_uniqueness_of' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_4::Nested_6:0x007f807b352430>
     # ./spec/models/user_spec.rb:62:in `block (4 levels) in <top (required)>'

  3) User#save when email address is already taken with equivalent email address 
     Failure/Error: it { should validate_uniqueness_of(:email) }
     NoMethodError:
       undefined method `validate_uniqueness_of' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_4::Nested_6::Nested_1:0x007f807af7de90>
     # ./spec/models/user_spec.rb:68:in `block (5 levels) in <top (required)>'

However, all tests pass when running them outside spring (rspec spec/models, I am not using the binstub).

I honestly don't know if it's something related to shoulda-matchers. But it seems spring is missing to load something.

Thanks

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