shoulda-matchers: Problems when running specs with Zeus
I’m using [zeus]
(https://github.com/burke/zeus) to pre-load the code, for when I’m running specs. It appears that zeus isn’t properly requiring shoulda-matchers
library for some reason.
I see errors like this:
1) User validations and associations
Failure/Error: it { should belong_to(:account) }
NoMethodError:
undefined method `belong_to' for #<RSpec::Core::ExampleGroup::Nested_3:0x00000104b8d850>
# ./spec/models/user_spec.rb:8:in `block (2 levels) in <top (required)>'
# -e:1:in `<main>'
2) User validations and associations
Failure/Error: it { should accept_nested_attributes_for(:account) }
NoMethodError:
undefined method `accept_nested_attributes_for' for #<RSpec::Core::ExampleGroup::Nested_3:0x00000104b94f88>
# ./spec/models/user_spec.rb:9:in `block (2 levels) in <top (required)>'
# -e:1:in `<main>'
3) User validations and associations
Failure/Error: it { validate_presence_of(:account) }
NoMethodError:
undefined method `validate_presence_of' for #<RSpec::Core::ExampleGroup::Nested_3:0x00000104b9c800>
# ./spec/models/user_spec.rb:10:in `block (2 levels) in <top (required)>'
# -e:1:in `<main>'
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 29 (3 by maintainers)
That’s because shoulda-matchers no longer installs itself into your test framework automatically. You’ll need to add this to your rails_helper:
Make sure you have
type: :model
as argument of the describe call in the model spec files.