Module: RSpec::Mocks::VerifyingDouble

Defined in:
lib/rspec/mocks/verifying_double.rb

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rspec/mocks/verifying_double.rb', line 20

def method_missing(message, *args, &block)
  # Null object conditional is an optimization. If not a null object,
  # validity of method expectations will have been checked at definition
  # time.
  if null_object?
    if @__sending_message == message
      __mock_proxy.ensure_implemented(message)
    else
      __mock_proxy.ensure_publicly_implemented(message, self)
    end

    __mock_proxy.validate_arguments!(message, args)
  end

  super
end