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

#append_call_record, #block_description, #describe_calls, #describe_spy, #describe_spy_expectation, #describe_spy_negative_expectation, #spy_description, #times_description

Constructor Details

This class inherits a constructor from FlexMock::CountValidator

Instance Method Details

#describeObject

Human readable description of the validator



132
133
134
# File 'lib/flexmock/validators.rb', line 132

def describe
  ".at_most#{super}"
end

#describe_limitObject



136
137
138
# File 'lib/flexmock/validators.rb', line 136

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

#validate(n) ⇒ Object

Validate the method expectation was called at least n times.



127
128
129
# File 'lib/flexmock/validators.rb', line 127

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