Class: Shoulda::ActiveModel::Matchers::ValidatePresenceOfMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Shoulda::ActiveModel::Matchers::ValidatePresenceOfMatcher
- Defined in:
- lib/shoulda/active_model/matchers/validate_presence_of_matcher.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from ValidationMatcher
Instance Method Summary collapse
Methods inherited from ValidationMatcher
#initialize, #negative_failure_message
Constructor Details
This class inherits a constructor from Shoulda::ActiveModel::Matchers::ValidationMatcher
Instance Method Details
#description ⇒ Object
35 36 37 |
# File 'lib/shoulda/active_model/matchers/validate_presence_of_matcher.rb', line 35 def description "require #{@attribute} to be set" end |
#matches?(subject) ⇒ Boolean
29 30 31 32 33 |
# File 'lib/shoulda/active_model/matchers/validate_presence_of_matcher.rb', line 29 def matches?(subject) super(subject) @expected_message ||= :blank disallows_value_of(blank_value, @expected_message) end |
#with_message(message) ⇒ Object
24 25 26 27 |
# File 'lib/shoulda/active_model/matchers/validate_presence_of_matcher.rb', line 24 def () @expected_message = if self end |