Class NotAMock::Matchers::CallMatcher
In: lib/not_a_mock/matchers/call_matcher.rb
Parent: Object

Methods

Attributes

calls  [R] 

Public Class methods

[Source]

   # File lib/not_a_mock/matchers/call_matcher.rb, line 5
5:       def initialize(parent = nil)
6:         @parent = parent
7:       end

Public Instance methods

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 38
38:       def and_returned(result)
39:         ResultMatcher.new(result, self)
40:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 42
42:       def exactly(n)
43:         TimesMatcher.new(n, self)
44:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 18
18:       def failure_message
19:         if parent_matched?
20:           parent_failure_message + failure_message_without_parents
21:         else
22:           parent_failure_message
23:         end
24:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 14
14:       def matched?; @matched end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 9
 9:       def matches?(object)
10:         @object = object
11:         @matched = parent_matches? && matches_without_parents?
12:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 26
26:       def negative_failure_message
27:         failure_message
28:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 45
45:       def once;  exactly(1) end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 46
46:       def twice; exactly(2) end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 30
30:       def with(*args)
31:         ArgsMatcher.new(args, self)
32:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 34
34:       def without_args
35:         ArgsMatcher.new([], self)
36:       end

Protected Instance methods

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 58
58:       def parent_failure_message
59:         @parent ? @parent.failure_message : @object.inspect
60:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 54
54:       def parent_matched?
55:         @parent.nil? || @parent.matched?
56:       end

[Source]

    # File lib/not_a_mock/matchers/call_matcher.rb, line 50
50:       def parent_matches?
51:         @parent.nil? || @parent.matches?(@object)
52:       end

[Validate]