Module: RR::TimesCalledMatchers::NonTerminal

Included in:
AnyTimesMatcher, AtLeastMatcher, ProcMatcher
Defined in:
lib/rr/times_called_matchers/non_terminal.rb

Overview

Including this module marks the TimesCalledMatcher as NonTerminal. Being NonTerminal means the Double will not “terminate” even when called infinite times.

The Double that uses a NonTerminal TimesCalledMatcher will continue using the Double when passed the matching arguments. This is done by the attempt? always returning true.

This is in opposition to Terminal TimesCalledMatchers, where attempt? will eventually return false.

Instance Method Summary collapse

Instance Method Details

#attempt?(times_called) ⇒ Boolean



22
23
24
# File 'lib/rr/times_called_matchers/non_terminal.rb', line 22

def attempt?(times_called)
  true
end

#possible_match?(times_called) ⇒ Boolean



18
19
20
# File 'lib/rr/times_called_matchers/non_terminal.rb', line 18

def possible_match?(times_called)
  true
end

#terminal?Boolean



14
15
16
# File 'lib/rr/times_called_matchers/non_terminal.rb', line 14

def terminal?
  false
end