Class: Shoulda::ActiveModel::Matchers::ValidationMatcher
- Inherits:
-
Object
- Object
- Shoulda::ActiveModel::Matchers::ValidationMatcher
- Defined in:
- lib/shoulda/active_model/matchers/validation_matcher.rb
Overview
:nodoc:
Direct Known Subclasses
EnsureInclusionOfMatcher, EnsureLengthOfMatcher, ValidateAcceptanceOfMatcher, ValidateFormatOfMatcher, ValidateNumericalityOfMatcher, ValidatePresenceOfMatcher, ValidateUniquenessOfMatcher
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
Instance Method Summary collapse
-
#initialize(attribute) ⇒ ValidationMatcher
constructor
A new instance of ValidationMatcher.
- #matches?(subject) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(attribute) ⇒ ValidationMatcher
Returns a new instance of ValidationMatcher.
9 10 11 |
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 9 def initialize(attribute) @attribute = attribute end |
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
7 8 9 |
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 7 def @failure_message end |
Instance Method Details
#matches?(subject) ⇒ Boolean
17 18 19 20 |
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 17 def matches?(subject) @subject = subject false end |
#negative_failure_message ⇒ Object
13 14 15 |
# File 'lib/shoulda/active_model/matchers/validation_matcher.rb', line 13 def @negative_failure_message || @failure_message end |