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

for(object, method_name, proxy) click to toggle source
# File lib/rspec/mocks/verifying_proxy.rb, line 198
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
new(object, method_name, proxy) click to toggle source
# File lib/rspec/mocks/verifying_proxy.rb, line 180
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

unimplemented?() click to toggle source
# File lib/rspec/mocks/verifying_proxy.rb, line 194
def unimplemented?
  !@valid_method
end
with_signature() { |method_signature| ... } click to toggle source
# File lib/rspec/mocks/verifying_proxy.rb, line 190
def with_signature
  yield Support::MethodSignature.new(original_implementation_callable)
end