123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Mocks::PartialDoubleProxy Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
RSpec::Mocks::PartialClassDoubleProxy, RSpec::Mocks::ProxyForNil, RSpec::Mocks::VerifyingPartialClassDoubleProxy, RSpec::Mocks::VerifyingPartialDoubleProxy
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Proxy
Instance Chain:
self, Proxy
Inherits: RSpec::Mocks::Proxy
Defined in: rspec-mocks/lib/rspec/mocks/proxy.rb

Constant Summary

Proxy - Inherited

DEFAULT_MESSAGE_EXPECTATION_OPTS

Class Method Summary

Instance Attribute Summary

Proxy - Inherited

Instance Method Summary

Instance Method Details

#add_simple_expectation(method_name, response, location)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/proxy.rb', line 331

def add_simple_expectation(method_name, response, location)
  method_double_for(method_name).configure_method
  super
end

#add_simple_stub(method_name, response)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/proxy.rb', line 337

def add_simple_stub(method_name, response)
  method_double_for(method_name).configure_method
  super
end

#any_instance_class_recorder_observing_method?(klass, method_name) ⇒ Boolean (private)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/proxy.rb', line 364

def any_instance_class_recorder_observing_method?(klass, method_name)
  only_return_existing = true
  recorder = ::RSpec::Mocks.space.any_instance_recorder_for(klass, only_return_existing)
  return true if recorder && recorder.already_observing?(method_name)

  superklass = klass.superclass
  return false if superklass.nil?
  any_instance_class_recorder_observing_method?(superklass, method_name)
end

#message_received(message, *args, &block)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/proxy.rb', line 354

def message_received(message, *args, &block)
  RSpec::Mocks.space.any_instance_recorders_from_ancestry_of(object).each do |subscriber|
    subscriber.notify_received_message(object, message, args, block)
  end
  super
end

#original_method_handle_for(message)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/proxy.rb', line 318

def original_method_handle_for(message)
  if any_instance_class_recorder_observing_method?(@object.class, message)
    message = ::RSpec::Mocks.space.
      any_instance_recorder_for(@object.class).
      build_alias_method_name(message)
  end

  ::RSpec::Support.method_handle_for(@object, message)
rescue NameError
  nil
end

#reset

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/proxy.rb', line 349

def reset
  @method_doubles.each_value { |d| d.reset }
  super
end

#visibility_for(method_name)

[ GitHub ]

  
# File 'rspec-mocks/lib/rspec/mocks/proxy.rb', line 343

def visibility_for(method_name)
  # We fall back to :public because by default we allow undefined methods
  # to be stubbed, and when we do so, we make them public.
  MethodReference.method_visibility_for(@object, method_name) || :public
end