class RSpec::Mocks::VerifyingExistingMethodDouble

@private
we can access the original pristine method definition.
collapse the reference and the method double into a single object so that
but when the original object is itself the one being modified we need to
original object, using a MethodReference. This works for pure doubles,
A VerifyingMethodDouble fetches the method to verify against from the

def self.for(object, method_name, proxy)

def self.for(object, method_name, proxy)
  if ClassNewMethodReference.applies_to?(method_name) { object }
    VerifyingExistingClassNewMethodDouble
  elsif Mocks.configuration.temporarily_suppress_partial_double_verification
    MethodDouble
  else
    self
  end.new(object, method_name, proxy)
end

def initialize(object, method_name, proxy)

def initialize(object, method_name, proxy)
  super(object, method_name, proxy, self)
  @valid_method = object.respond_to?(method_name, true)
  # Trigger an eager find of the original method since if we find it any
  # later we end up getting a stubbed method with incorrect arity.
  save_original_implementation_callable!
end

def unimplemented?

def unimplemented?
  !@valid_method
end

def with_signature

def with_signature
  yield Support::MethodSignature.new(original_implementation_callable)
end