You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require "active_model"
require "shoulda-matchers"
class Car
include ActiveModel::Validations
attr_accessor :wheels, :windows
validates_numericality_of :wheels, strict: true
validates_numericality_of :windows
def self.instance
instance = new
instance.windows = 4
instance.wheels = 4
instance
end
end
describe Car do
subject { Car.instance }
it { should validate_numericality_of(:windows) }
it { should validate_numericality_of(:wheels).strict }
end
Turns out this feature is not supported.
.F
Failures:
1) Car
Failure/Error: it { should validate_numericality_of(:wheels).strict }
NoMethodError:
undefined method `strict' for #<Shoulda::Matchers::ActiveModel::ValidateNumericalityOfMatcher:0x00000002e14748>
# ./car_spec.rb:20:in `block (2 levels) in <top (required)>'
Finished in 0.02826 seconds (files took 0.16763 seconds to load)
2 examples, 1 failure
Failed examples:
rspec ./car_spec.rb:20 # Car
The text was updated successfully, but these errors were encountered:
Turns out this feature is not supported.
The text was updated successfully, but these errors were encountered: