Class: NotAMock::Matchers::MethodMatcher
- Inherits:
-
CallMatcher
- Object
- CallMatcher
- NotAMock::Matchers::MethodMatcher
- Defined in:
- lib/not_a_mock/matchers/method_matcher.rb
Overview
Matcher for
object.should have_received(...)
Instance Attribute Summary
Attributes inherited from CallMatcher
Instance Method Summary collapse
- #failure_message_without_parents ⇒ Object
-
#initialize(method, parent = nil) ⇒ MethodMatcher
constructor
A new instance of MethodMatcher.
- #matches_without_parents? ⇒ Boolean
Methods inherited from CallMatcher
#and_returned, #exactly, #failure_message, #matched?, #matches?, #negative_failure_message, #once, #twice, #with, #without_args
Constructor Details
#initialize(method, parent = nil) ⇒ MethodMatcher
Returns a new instance of MethodMatcher.
9 10 11 12 |
# File 'lib/not_a_mock/matchers/method_matcher.rb', line 9 def initialize(method, parent = nil) super parent @method = method end |
Instance Method Details
#failure_message_without_parents ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/not_a_mock/matchers/method_matcher.rb', line 19 def if matched? " received #{@method}" else " didn't receive #{@method}" end end |
#matches_without_parents? ⇒ Boolean
14 15 16 17 |
# File 'lib/not_a_mock/matchers/method_matcher.rb', line 14 def matches_without_parents? @calls = CallRecorder.instance.calls_by_object_and_method(@object, @method) !@calls.empty? end |