class RSpec::Mocks::AnyInstance::Recorder

def mark_invoked!(method_name)

def mark_invoked!(method_name)
  backup_method!(method_name)
  @klass.class_eval(<<-EOM, __FILE__, __LINE__)
    def #{method_name}(*args, &blk)
      method_name = :#{method_name}
      klass = ::Object.instance_method(:method).bind(self).call(:#{method_name}).owner
      invoked_instance = klass.__recorder.instance_that_received(method_name)
      raise RSpec::Mocks::MockExpectationError, "The message '#{method_name}' was received by \#{self.inspect} but has already been received by \#{invoked_instance}"
    end
  EOM
end