Class: Shoulda::Matchers::ActiveModel::ValidationMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActiveModel::ValidationMatcher
- Defined in:
- lib/shoulda/matchers/active_model/validation_matcher.rb
Overview
:nodoc:
Direct Known Subclasses
EnsureExclusionOfMatcher, EnsureInclusionOfMatcher, EnsureLengthOfMatcher, ValidateAcceptanceOfMatcher, ValidateConfirmationOfMatcher, ValidatePresenceOfMatcher, ValidateUniquenessOfMatcher
Instance Attribute Summary (collapse)
-
- (Object) failure_message_for_should
readonly
Returns the value of attribute failure_message_for_should.
Instance Method Summary (collapse)
- - (Object) failure_message_for_should_not
-
- (ValidationMatcher) initialize(attribute)
constructor
A new instance of ValidationMatcher.
- - (Boolean) matches?(subject)
- - (Object) on(context)
- - (Object) strict
Constructor Details
- (ValidationMatcher) initialize(attribute)
A new instance of ValidationMatcher
7 8 9 10 |
# File 'lib/shoulda/matchers/active_model/validation_matcher.rb', line 7 def initialize(attribute) @attribute = attribute @strict = false end |
Instance Attribute Details
- (Object) failure_message_for_should (readonly)
Returns the value of attribute failure_message_for_should
5 6 7 |
# File 'lib/shoulda/matchers/active_model/validation_matcher.rb', line 5 def @failure_message_for_should end |
Instance Method Details
- (Object) failure_message_for_should_not
22 23 24 |
# File 'lib/shoulda/matchers/active_model/validation_matcher.rb', line 22 def @failure_message_for_should_not || @failure_message_for_should end |
- (Boolean) matches?(subject)
26 27 28 29 |
# File 'lib/shoulda/matchers/active_model/validation_matcher.rb', line 26 def matches?(subject) @subject = subject false end |
- (Object) on(context)
12 13 14 15 |
# File 'lib/shoulda/matchers/active_model/validation_matcher.rb', line 12 def on(context) @context = context self end |
- (Object) strict
17 18 19 20 |
# File 'lib/shoulda/matchers/active_model/validation_matcher.rb', line 17 def strict @strict = true self end |