class RSpec::Mocks::VerifyingProxy
@private
isolation.
loaded, otherwise they are disabled. This allows for testing in
These checks are only activated if the doubled class has already been
implementation.
verification behaviour to specific methods then delegates to the parent
In all other ways this behaves like a normal proxy. It only adds the
validity of arguments on method calls.
set on it. This includes whether or not methods have been defined and the
contains extra logic to try and determine the validity of any expectation
A verifying proxy mostly acts like a normal proxy, except that it
def initialize(object, order_group, doubled_module, method_reference_class)
def initialize(object, order_group, doubled_module, method_reference_class) super(object, order_group) @object = object @doubled_module = doubled_module @method_reference_class = method_reference_class # A custom method double is required to pass through a way to lookup # methods to determine their parameters. This is only relevant if the doubled # class is loaded. @method_doubles = Hash.new do |h, k| h[k] = VerifyingMethodDouble.new(@object, k, self, method_reference[k]) end end
def method_reference
def method_reference @method_reference ||= Hash.new do |h, k| h[k] = @method_reference_class.for(@doubled_module, k) end end
def validate_arguments!(method_name, args)
def validate_arguments!(method_name, args) @method_doubles[method_name].validate_arguments!(args) end
def visibility_for(method_name)
def visibility_for(method_name) method_reference[method_name].visibility end