class FlexMock::AtMostCountValidator

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

Public Instance Methods

describe() click to toggle source

Human readable description of the validator

# File lib/flexmock/validators.rb, line 129
def describe
  ".at_most#{super}"
end
validate(n) click to toggle source

Validate the method expectation was called at least n times.

# File lib/flexmock/validators.rb, line 116
def validate(n)
  @exp.flexmock_location_filter do
    FlexMock.framework_adapter.assert_block(
      lambda {
        "Method '#{@exp}' called incorrect number of times\n" +
        "At most #{@limit} matching #{calls(@limit)} expected\n" +
        "#{n} matching #{calls(n)} found\n" +
        describe_calls(@exp.mock)
      }) { n <= @limit }
  end
end