Class: Shoulda::ActiveModel::Matchers::ValidateNumericalityOfMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Shoulda::ActiveModel::Matchers::ValidateNumericalityOfMatcher
- Defined in:
- lib/shoulda/active_model/matchers/validate_numericality_of_matcher.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from ValidationMatcher
Instance Method Summary collapse
Methods inherited from ValidationMatcher
#initialize, #negative_failure_message
Constructor Details
This class inherits a constructor from Shoulda::ActiveModel::Matchers::ValidationMatcher
Instance Method Details
#description ⇒ Object
32 33 34 |
# File 'lib/shoulda/active_model/matchers/validate_numericality_of_matcher.rb', line 32 def description "only allow numeric values for #{@attribute}" end |
#matches?(subject) ⇒ Boolean
26 27 28 29 30 |
# File 'lib/shoulda/active_model/matchers/validate_numericality_of_matcher.rb', line 26 def matches?(subject) super(subject) @expected_message ||= :not_a_number disallows_value_of('abcd', @expected_message) end |
#with_message(message) ⇒ Object
21 22 23 24 |
# File 'lib/shoulda/active_model/matchers/validate_numericality_of_matcher.rb', line 21 def () @expected_message = if self end |