Class: RSpec::Mocks::InstanceVerifyingDouble

Inherits:
Object
  • Object
show all
Includes:
TestDouble, VerifyingDouble
Defined in:
lib/rspec/mocks/verifying_double.rb

Overview

A mock providing a custom proxy that can verify the validity of any method stubs or expectations against the public instance methods of the given class.

Instance Method Summary (collapse)

Methods included from VerifyingDouble

#__send__, #method_missing, #respond_to?, #send

Methods included from TestDouble

#==, #__disallow_further_usage!, #as_null_object, #freeze, #inspect, #null_object?, #respond_to?, #to_s

Constructor Details

- (InstanceVerifyingDouble) initialize(doubled_module, *args)



66
67
68
69
70
71
72
73
# File 'lib/rspec/mocks/verifying_double.rb', line 66

def initialize(doubled_module, *args)
  @doubled_module = doubled_module

  super(
    "#{doubled_module.description} (instance)",
    *args
  )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RSpec::Mocks::VerifyingDouble

Instance Method Details

- (Object) __build_mock_proxy(order_group)



75
76
77
78
79
80
# File 'lib/rspec/mocks/verifying_double.rb', line 75

def __build_mock_proxy(order_group)
  VerifyingProxy.new(self, order_group,
    @doubled_module,
    InstanceMethodReference
  )
end