Class: RSpec::Mocks::PartialDoubleProxy

Inherits:
Proxy show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/proxy.rb

Constant Summary

Constants inherited from Proxy

RSpec::Mocks::Proxy::DEFAULT_MESSAGE_EXPECTATION_OPTS

Instance Attribute Summary

Attributes inherited from Proxy

#object

Instance Method Summary collapse

Methods inherited from Proxy

#add_message_expectation, #add_stub, #as_null_object, #build_expectation, #check_for_unexpected_arguments, #ensure_can_be_proxied!, #ensure_implemented, #has_negative_expectation?, #initialize, #messages_arg_list, #method_double_if_exists_for_message, #null_object?, prepended_modules_of, #prepended_modules_of_singleton_class, #raise_missing_default_stub_error, #raise_unexpected_message_error, #received_message?, #record_message_received, #remove_stub, #remove_stub_if_present, #replay_received_message_on, #verify

Constructor Details

This class inherits a constructor from RSpec::Mocks::Proxy

Instance Method Details

#add_simple_expectation(method_name, response, location) ⇒ Object



334
335
336
337
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/proxy.rb', line 334

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

#add_simple_stub(method_name, response) ⇒ Object



340
341
342
343
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/proxy.rb', line 340

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

#message_received(message, *args, &block) ⇒ Object



357
358
359
360
361
362
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/proxy.rb', line 357

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) ⇒ Object



321
322
323
324
325
326
327
328
329
330
331
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/proxy.rb', line 321

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

#resetObject



352
353
354
355
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/proxy.rb', line 352

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

#visibility_for(method_name) ⇒ Object



346
347
348
349
350
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/proxy.rb', line 346

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