Class: FlexMock::CountValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/flexmock/validators.rb

Overview

Base class for all the count validators.

Instance Method Summary collapse

Constructor Details

#initialize(expectation, limit) ⇒ CountValidator

Returns a new instance of CountValidator.



20
21
22
23
# File 'lib/flexmock/validators.rb', line 20

def initialize(expectation, limit)
  @exp = expectation
  @limit = limit
end

Instance Method Details

#eligible?(n) ⇒ Boolean

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.

Returns:

  • (Boolean)


28
29
30
# File 'lib/flexmock/validators.rb', line 28

def eligible?(n)
  n < @limit
end