FlexMock::AtLeastCountValidator

Validator for call counts greater 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 94
def describe
  if @limit == 0
    ".zero_or_more_times"
  else
    ".at_least#{super}"
  end
end
eligible?(n) click to toggle source

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.

# File lib/flexmock/validators.rb, line 106
def eligible?(n)
  true
end
validate(n) click to toggle source

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

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.