Base class for all the count validators.
# File lib/flexmock/validators.rb, line 23 def initialize(expectation, limit) @exp = expectation @limit = limit end
Pluralize “call”
# File lib/flexmock/validators.rb, line 36 def calls(n) n == 1 ? "call" : "calls" end
Human readable description of the validator
# File lib/flexmock/validators.rb, line 41 def describe case @limit when 0 ".never" when 1 ".once" when 2 ".twice" else ".times(#{@limit})" end end
If the expectation has been called n
times, is it still
eligible to be called again? The default answer compares n to the
established limit.
# File lib/flexmock/validators.rb, line 31 def eligible?(n) n < @limit end