class RSpec::Mocks::Proxy

def find_almost_matching_expectation(method_name, *args)

def find_almost_matching_expectation(method_name, *args)
  method_double[method_name].expectations.find do |expectation|
    expectation.matches_name_but_not_args(method_name, *args) && !expectation.called_max_times?
  end || method_double[method_name].expectations.find do |expectation|
    expectation.matches_name_but_not_args(method_name, *args)
  end
end