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, #failure_reason, #on, #strict, #with_message
Methods included from Qualifiers::IgnoringInterferenceByWriter
#ignoring_interference_by_writer
Constructor Details
#initialize(attribute) ⇒ ValidateConfirmationOfMatcher
Returns a new instance of ValidateConfirmationOfMatcher.
108 109 110 111 112 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 108 def initialize(attribute) super @expected_message = :confirmation @confirmation_attribute = "#{attribute}_confirmation" end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
106 107 108 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 106 def attribute @attribute end |
#confirmation_attribute ⇒ Object (readonly)
Returns the value of attribute confirmation_attribute.
106 107 108 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 106 def confirmation_attribute @confirmation_attribute end |
Instance Method Details
#does_not_match?(subject) ⇒ Boolean
126 127 128 129 130 131 132 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 126 def does_not_match?(subject) super(subject) allows_different_value || disallows_same_value || disallows_missing_confirmation end |
#matches?(subject) ⇒ Boolean
118 119 120 121 122 123 124 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 118 def matches?(subject) super(subject) disallows_different_value && allows_same_value && allows_missing_confirmation end |
#simple_description ⇒ Object
114 115 116 |
# File 'lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb', line 114 def simple_description "validate that :#{@confirmation_attribute} matches :#{@attribute}" end |