Class: Shoulda::Lotus::Matchers::ValidatePresenceOfMatcher
- Inherits:
-
Object
- Object
- Shoulda::Lotus::Matchers::ValidatePresenceOfMatcher
- Defined in:
- lib/shoulda/lotus/matchers/validate_presence_of_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(attribute) ⇒ ValidatePresenceOfMatcher
constructor
A new instance of ValidatePresenceOfMatcher.
- #matches?(target) ⇒ Boolean
Constructor Details
#initialize(attribute) ⇒ ValidatePresenceOfMatcher
9 10 11 |
# File 'lib/shoulda/lotus/matchers/validate_presence_of_matcher.rb', line 9 def initialize(attribute) @attribute = attribute end |
Instance Method Details
#description ⇒ Object
17 18 19 |
# File 'lib/shoulda/lotus/matchers/validate_presence_of_matcher.rb', line 17 def description "require '#{@attribute}' to be set" end |
#failure_message ⇒ Object
21 22 23 |
# File 'lib/shoulda/lotus/matchers/validate_presence_of_matcher.rb', line 21 def "'#{@attribute}' is a required attribute" end |
#failure_message_when_negated ⇒ Object
25 26 27 |
# File 'lib/shoulda/lotus/matchers/validate_presence_of_matcher.rb', line 25 def "'#{@attribute}' is not a required attribute" end |