Hi, I recently updated to rails 4.2.5.1 and shoulda-matchers to 3.1.0 (from 2.8.0). My tests which use:
have started failing. I suspect failure is more general than just those two methods. Error log doesn't really say much:
Failure/Error: should validate_length_of(:username)
NoMethodError:
undefined method `validate_length_of' for #<RSpec::ExampleGroups::User:0x0000000432c400>
# ./spec/models/user_spec.rb:5:in `block (2 levels) in <top (required)>'
If you help you investigate this I can send PR. This issue doesn't exist on shoulda-matchers 2.8.0.
I have pushed an example app at here. Its model is:
#app/models/user.rb
class User < ActiveRecord::Base
validates_length_of :username, minimum: 10
end
test (with rspec-rails 3.4.0):
#spec/models/user_spec.rb
require 'rails_helper'
describe User do
it do
should validate_length_of(:username)
end
end
shoulda-matchers no longer automatically mixes itself into your test framework -- you need to use a configuration block to manually tell the gem which test framework you're using. See the relevant part of the README for more.
Thanks @mcmire :heart:
Most helpful comment
Thanks @mcmire :heart: