Class: Plyushkin::Test::HoardedAttributeMatcher::CallbackMatcher
- Inherits:
-
Object
- Object
- Plyushkin::Test::HoardedAttributeMatcher::CallbackMatcher
- Defined in:
- lib/plyushkin/test/hoarded_attribute_matcher.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(attr_name, callback) ⇒ CallbackMatcher
constructor
A new instance of CallbackMatcher.
- #match(subject) ⇒ Object
- #message(negate) ⇒ Object
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(attr_name, callback) ⇒ CallbackMatcher
Returns a new instance of CallbackMatcher.
76 77 78 |
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 76 def initialize(attr_name, callback) @attr_name, @callback = attr_name, callback end |
Instance Method Details
#failure_message ⇒ Object
85 86 87 |
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 85 def (true) end |
#match(subject) ⇒ Object
80 81 82 83 |
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 80 def match(subject) callbacks = subject.class.plyushkin_model.callbacks[@attr_name] callbacks && (callbacks[:after_create] == @callback) end |
#message(negate) ⇒ Object
93 94 95 |
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 93 def (negate) "Plyushkin:: Hoarded attribute #{@attr_name} #{negate ? "does not callback" : "calls back"} #{@callback}" end |
#negative_failure_message ⇒ Object
89 90 91 |
# File 'lib/plyushkin/test/hoarded_attribute_matcher.rb', line 89 def (false) end |