Class: FlexMock::AtLeastCountValidator
- Inherits:
-
CountValidator
- Object
- CountValidator
- FlexMock::AtLeastCountValidator
- Defined in:
- lib/flexmock/validators.rb
Overview
Validator for call counts greater than or equal to a limit.
Instance Method Summary collapse
-
#describe ⇒ Object
Human readable description of the validator.
- #describe_limit ⇒ Object
-
#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. -
#validate(n) ⇒ Object
Validate the method expectation was called no more than
n
times.
Methods inherited from CountValidator
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
permalink #describe ⇒ Object
Human readable description of the validator.
101 102 103 104 105 106 107 |
# File 'lib/flexmock/validators.rb', line 101 def describe if @limit == 0 ".zero_or_more_times" else ".at_least#{super}" end end |
permalink #describe_limit ⇒ Object
[View source]
117 118 119 |
# File 'lib/flexmock/validators.rb', line 117 def describe_limit "At least #{@limit}" end |
permalink #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.
113 114 115 |
# File 'lib/flexmock/validators.rb', line 113 def eligible?(n) true end |
permalink #validate(n) ⇒ Object
Validate the method expectation was called no more than n
times.
96 97 98 |
# File 'lib/flexmock/validators.rb', line 96 def validate(n) validate_count(n) { n >= @limit } end |