class RSpec::Mocks::VerifyingExistingMethodDouble
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
Public Class Methods
# File rspec-mocks/lib/rspec/mocks/verifying_proxy.rb, line 199 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
Calls superclass method
RSpec::Mocks::VerifyingMethodDouble::new
# File rspec-mocks/lib/rspec/mocks/verifying_proxy.rb, line 181 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
Public Instance Methods
# File rspec-mocks/lib/rspec/mocks/verifying_proxy.rb, line 195 def unimplemented? !@valid_method end
# File rspec-mocks/lib/rspec/mocks/verifying_proxy.rb, line 191 def with_signature yield Support::MethodSignature.new(original_implementation_callable) end