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 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_method!
end

def unimplemented?

def unimplemented?
  !@valid_method
end

def with_signature

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