Class: Shoulda::Lotus::Matchers::AllowValueMatcher
- Inherits:
-
Object
- Object
- Shoulda::Lotus::Matchers::AllowValueMatcher
- Defined in:
- lib/shoulda/lotus/matchers/allow_value_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
- #for(attribute) ⇒ Object
-
#initialize(value) ⇒ AllowValueMatcher
constructor
A new instance of AllowValueMatcher.
- #matches?(target) ⇒ Boolean
Constructor Details
#initialize(value) ⇒ AllowValueMatcher
9 10 11 |
# File 'lib/shoulda/lotus/matchers/allow_value_matcher.rb', line 9 def initialize(value) @value = value end |
Instance Method Details
#description ⇒ Object
18 19 20 |
# File 'lib/shoulda/lotus/matchers/allow_value_matcher.rb', line 18 def description "allow '#{@value}' to be set to '#{@attribute}'" end |
#failure_message ⇒ Object
22 23 24 |
# File 'lib/shoulda/lotus/matchers/allow_value_matcher.rb', line 22 def "'#{@value}' is an invalid format for '#{@attribute}'" end |
#failure_message_when_negated ⇒ Object
26 27 28 |
# File 'lib/shoulda/lotus/matchers/allow_value_matcher.rb', line 26 def "'#{@value}' is a valid format for '#{@attribute}'" end |
#for(attribute) ⇒ Object
30 31 32 33 |
# File 'lib/shoulda/lotus/matchers/allow_value_matcher.rb', line 30 def for(attribute) @attribute = attribute self end |