Class: Plyushkin::Test::PersistedAttributeMatcher::WithFormatMatcher
- Inherits:
-
Object
- Object
- Plyushkin::Test::PersistedAttributeMatcher::WithFormatMatcher
- Defined in:
- lib/plyushkin/test/persisted_attribute_matcher.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(attr_name, formatter) ⇒ WithFormatMatcher
constructor
A new instance of WithFormatMatcher.
- #match(subject) ⇒ Object
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(attr_name, formatter) ⇒ WithFormatMatcher
Returns a new instance of WithFormatMatcher.
19 20 21 |
# File 'lib/plyushkin/test/persisted_attribute_matcher.rb', line 19 def initialize(attr_name, formatter) @attr_name, @formatter = attr_name, formatter end |
Instance Method Details
#failure_message ⇒ Object
27 28 29 |
# File 'lib/plyushkin/test/persisted_attribute_matcher.rb', line 27 def "Plyushkin: attribute #{@attr_name} is not formatting with #{@formatter}" end |
#match(subject) ⇒ Object
23 24 25 |
# File 'lib/plyushkin/test/persisted_attribute_matcher.rb', line 23 def match(subject) subject.class.formatters[@attr_name] == @formatter end |
#negative_failure_message ⇒ Object
31 32 33 |
# File 'lib/plyushkin/test/persisted_attribute_matcher.rb', line 31 def "Plyushkin: attribute #{@attr_name} is formatting with #{@formatter}" end |