Class: NotAMock::Matchers::ResultMatcher
- Inherits:
-
CallMatcher
- Object
- CallMatcher
- NotAMock::Matchers::ResultMatcher
- Defined in:
- lib/not_a_mock/matchers/result_matcher.rb
Overview
Matcher for
and_returned(...)
Instance Attribute Summary
Attributes inherited from CallMatcher
Instance Method Summary collapse
- #failure_message_without_parents ⇒ Object
-
#initialize(result, parent = nil) ⇒ ResultMatcher
constructor
A new instance of ResultMatcher.
- #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(result, parent = nil) ⇒ ResultMatcher
Returns a new instance of ResultMatcher.
9 10 11 12 |
# File 'lib/not_a_mock/matchers/result_matcher.rb', line 9 def initialize(result, parent = nil) super parent @result = result end |
Instance Method Details
#failure_message_without_parents ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/not_a_mock/matchers/result_matcher.rb', line 19 def if matched? ", and returned #{@result.inspect}" else ", but didn't return #{@result.inspect}" end end |
#matches_without_parents? ⇒ Boolean
14 15 16 17 |
# File 'lib/not_a_mock/matchers/result_matcher.rb', line 14 def matches_without_parents? @calls = @parent.calls.select {|entry| entry[:result] == @result } !@calls.empty? end |