Class: Shoulda::Matchers::ActiveModel::ValidateAbsenceOfMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Shoulda::Matchers::ActiveModel::ValidateAbsenceOfMatcher
- Defined in:
- lib/shoulda/matchers/active_model/validate_absence_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) ⇒ ValidateAbsenceOfMatcher
constructor
A new instance of ValidateAbsenceOfMatcher.
- #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) ⇒ ValidateAbsenceOfMatcher
Returns a new instance of ValidateAbsenceOfMatcher.
81 82 83 84 |
# File 'lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb', line 81 def initialize(attribute) super @expected_message = :present end |
Instance Method Details
#does_not_match?(subject) ⇒ Boolean
91 92 93 94 |
# File 'lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb', line 91 def does_not_match?(subject) super(subject) allows_value_of(value, @expected_message) end |
#matches?(subject) ⇒ Boolean
86 87 88 89 |
# File 'lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb', line 86 def matches?(subject) super(subject) disallows_value_of(value, @expected_message) end |
#simple_description ⇒ Object
96 97 98 |
# File 'lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb', line 96 def simple_description "validate that :#{@attribute} is empty/falsy" end |