A VerifyingMethodDouble fetches the method to verify against from the original object, using a MethodReference. This works for pure doubles, but when the original object is itself the one being modified we need to collapse the reference and the method double into a single object so that we can access the original pristine method definition.
@private
# File lib/rspec/mocks/verifying_proxy.rb, line 151 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
# File lib/rspec/mocks/verifying_proxy.rb, line 165 def unimplemented? !@valid_method end
# File lib/rspec/mocks/verifying_proxy.rb, line 161 def with_signature yield Support::MethodSignature.new(original_method) end