class RSpec::Mocks::VerifyingExistingMethodDouble
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
@api private
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) # 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 when_defined
def when_defined yield original_method end
def when_unimplemented
def when_unimplemented yield unless @valid_method end