Module: Opal::RSpec::VerifyingDoubleFixes

Included in:
RSpec::Mocks::ObjectVerifyingDouble, RSpec::Mocks::VerifyingDouble
Defined in:
opal/opal/rspec/fixes/rspec/mocks/verifying_double.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'opal/opal/rspec/fixes/rspec/mocks/verifying_double.rb', line 3

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
  end

  call_method_missing message, *args, &block
end