Class: Shoulda::Matchers::ActiveModel::ValidateAcceptanceOfMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Shoulda::Matchers::ActiveModel::ValidateAcceptanceOfMatcher
- Defined in:
- lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb
Instance Attribute Summary
Attributes included from Qualifiers::IgnoringInterferenceByWriter
#ignore_interference_by_writer
Instance Method Summary collapse
- #does_not_match?(subject) ⇒ Boolean
-
#initialize(attribute) ⇒ ValidateAcceptanceOfMatcher
constructor
A new instance of ValidateAcceptanceOfMatcher.
- #matches?(subject) ⇒ Boolean
- #simple_description ⇒ Object
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) ⇒ ValidateAcceptanceOfMatcher
Returns a new instance of ValidateAcceptanceOfMatcher.
84 85 86 87 |
# File 'lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb', line 84 def initialize(attribute) super @expected_message = :accepted end |
Instance Method Details
#does_not_match?(subject) ⇒ Boolean
94 95 96 97 |
# File 'lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb', line 94 def does_not_match?(subject) super(subject) allows_value_of(false, @expected_message) end |
#matches?(subject) ⇒ Boolean
89 90 91 92 |
# File 'lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb', line 89 def matches?(subject) super(subject) disallows_value_of(false, @expected_message) end |
#simple_description ⇒ Object
99 100 101 |
# File 'lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb', line 99 def simple_description %(validate that :#{@attribute} has been set to "1") end |