Class: Shoulda::Matchers::ActiveModel::ValidateConfirmationOfMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Shoulda::Matchers::ActiveModel::ValidateConfirmationOfMatcher
- Includes:
- Helpers
- Defined in:
- lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#confirmation_attribute ⇒ Object
readonly
Returns the value of attribute confirmation_attribute.
Attributes included from Qualifiers::IgnoringInterferenceByWriter
#ignore_interference_by_writer
Instance Method Summary collapse
- #does_not_match?(subject) ⇒ Boolean
-
#initialize(attribute) ⇒ ValidateConfirmationOfMatcher
constructor
A new instance of ValidateConfirmationOfMatcher.
- #matches?(subject) ⇒ Boolean
- #simple_description ⇒ Object
Methods included from Helpers
#default_error_message, #format_validation_errors, #pretty_error_messages
Methods inherited from ValidationMatcher
#allow_blank, #description, #expects_custom_validation_message?, #expects_strict?, #failure_message, #failure_message_when_negated, #on, #strict, #with_message
Methods included from Qualifiers::IgnoringInterferenceByWriter
#ignoring_interference_by_writer
Constructor Details
#initialize(attribute) ⇒ ValidateConfirmationOfMatcher
Returns a new instance of ValidateConfirmationOfMatcher.
85 86 87 88 89 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 85 def initialize(attribute) super @expected_message = :confirmation @confirmation_attribute = "#{attribute}_confirmation" end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
83 84 85 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 83 def attribute @attribute end |
#confirmation_attribute ⇒ Object (readonly)
Returns the value of attribute confirmation_attribute.
83 84 85 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 83 def confirmation_attribute @confirmation_attribute end |
Instance Method Details
#does_not_match?(subject) ⇒ Boolean
103 104 105 106 107 108 109 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 103 def does_not_match?(subject) super(subject) allows_different_value || disallows_same_value || disallows_missing_confirmation end |
#matches?(subject) ⇒ Boolean
95 96 97 98 99 100 101 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 95 def matches?(subject) super(subject) disallows_different_value && allows_same_value && allows_missing_confirmation end |
#simple_description ⇒ Object
91 92 93 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 91 def simple_description "validate that :#{@confirmation_attribute} matches :#{@attribute}" end |