Class NotAMock::Matchers::TimesMatcher
In: lib/not_a_mock/matchers/times_matcher.rb
Parent: CallMatcher

Matcher for once, twice, and

  exactly(n).times

Methods

Public Class methods

[Source]

    # File lib/not_a_mock/matchers/times_matcher.rb, line 9
 9:       def initialize(times, parent = nil)
10:         super parent
11:         @times = times
12:       end

Public Instance methods

[Source]

    # File lib/not_a_mock/matchers/times_matcher.rb, line 19
19:       def failure_message_without_parents
20:         if matched?
21:           ", #{times_in_english(@parent.calls.length)}"
22:         else
23:           ", but #{times_in_english(@parent.calls.length, true)}"
24:         end
25:       end

[Source]

    # File lib/not_a_mock/matchers/times_matcher.rb, line 14
14:       def matches_without_parents?
15:         @calls = @parent.calls
16:         @calls.length == @times
17:       end

[Source]

    # File lib/not_a_mock/matchers/times_matcher.rb, line 27
27:       def times
28:         self
29:       end

[Validate]