Class: FlexMock::AtLeastCountValidator

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

Overview

Validator for call counts greater than or equal to a limit.

Instance Method Summary collapse

Methods inherited from CountValidator

#initialize

Constructor Details

This class inherits a constructor from FlexMock::CountValidator

Instance Method Details

#eligible?(n) ⇒ Boolean

If the expectation has been called n times, is it still eligible to be called again? Since this validator only establishes a lower limit, not an upper limit, then the answer is always true.

Returns:

  • (Boolean)


61
62
63
# File 'lib/flexmock/validators.rb', line 61

def eligible?(n)
  true
end

#validate(n) ⇒ Object

Validate the method expectation was called no more than n times.



51
52
53
54
55
# File 'lib/flexmock/validators.rb', line 51

def validate(n)
  FlexMock.framework_adapter.assert_block(
    "Method '#{@exp}' should be called at least #{@limit} times,\n" +
    "only called #{n} times") { n >= @limit }
end