Class: RSpec::Mocks::VerifyingMethodDouble

Inherits:
Object
  • Object
show all
Defined in:
lib/type_tracer/rspec/instance_double_arg_checker.rb

Instance Method Summary collapse

Instance Method Details

#orig_proxy_method_invokedObject



9
# File 'lib/type_tracer/rspec/instance_double_arg_checker.rb', line 9

alias orig_proxy_method_invoked proxy_method_invoked

#proxy_method_invoked(obj, *args, &block) ⇒ Object

Raises:

  • (MockExpectationError.new)


11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/type_tracer/rspec/instance_double_arg_checker.rb', line 11

def proxy_method_invoked(obj, *args, &block)
  orig_proxy_method_invoked(obj, *args, &block)
  return unless obj.is_a?(InstanceVerifyingDouble)

  name = @method_reference.instance_variable_get('@method_name')
  klass = @method_reference.instance_variable_get('@object_reference')
                           .instance_variable_get('@object')

  checker = TypeTracer::RealArgSendsChecker.new(klass, name, args)
  messages = checker.invalid_arg_messages
  raise MockExpectationError.new, messages.join("\n") unless messages.empty?
end