class FlexMock::ExactCountValidator

Validator for exact call counts.

Public Instance Methods

validate(n) click to toggle source

Validate that the method expectation was called exactly n times.

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