Class: RSpec::Mocks::PartialDoubleProxy

Inherits:
Proxy
  • Object
show all
Defined in:
lib/rspec/mocks/proxy.rb

Direct Known Subclasses

PartialClassDoubleProxy, ProxyForNil, VerifyingPartialDoubleProxy

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, #has_negative_expectation?, #initialize, #message_received, #null_object?, #prepended_modules_of_singleton_class, #raise_missing_default_stub_error, #raise_unexpected_message_args_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

- (Object) add_simple_expectation(method_name, response, location)



273
274
275
276
# File 'lib/rspec/mocks/proxy.rb', line 273

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

- (Object) add_simple_stub(method_name, response)



279
280
281
282
# File 'lib/rspec/mocks/proxy.rb', line 279

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

- (Object) original_method_handle_for(message)



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/rspec/mocks/proxy.rb', line 260

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

- (Object) reset



291
292
293
294
# File 'lib/rspec/mocks/proxy.rb', line 291

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

- (Object) visibility_for(method_name)



285
286
287
288
289
# File 'lib/rspec/mocks/proxy.rb', line 285

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