Class: FlexMock::AtMostCountValidator

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

Overview

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

Instance Method Summary collapse

Methods inherited from CountValidator

#eligible?, #initialize, #validate_count

Methods included from SpyDescribers

#describe_spy_expectation, #describe_spy_negative_expectation, #spy_description

Constructor Details

This class inherits a constructor from FlexMock::CountValidator

Instance Method Details

#describeObject

Human readable description of the validator



130
131
132
# File 'lib/flexmock/validators.rb', line 130

def describe
  ".at_most#{super}"
end

#describe_limitObject



134
135
136
# File 'lib/flexmock/validators.rb', line 134

def describe_limit
  "At most #{@limit}"
end

#validate(n) ⇒ Object

Validate the method expectation was called at least n times.



125
126
127
# File 'lib/flexmock/validators.rb', line 125

def validate(n)
  validate_count(n) { n <= @limit }
end