Class: Muack::Stub

Inherits:
Mock
  • Object
show all
Defined in:
lib/muack/stub.rb

Instance Attribute Summary

Attributes inherited from Mock

#object

Instance Method Summary collapse

Methods inherited from Mock

#__mock_class, #__mock_defis_pop, #__mock_defis_push, #__mock_dispatch_call, #__mock_reset, #initialize, #inspect, #method_missing

Constructor Details

This class inherits a constructor from Muack::Mock

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Muack::Mock

Instance Method Details

#__mock_dispatch(msg, actual_args) ⇒ Object

used for mocked object to dispatch mocked method



10
11
12
13
14
15
16
17
18
19
# File 'lib/muack/stub.rb', line 10

def __mock_dispatch msg, actual_args
  if defi = __mock_defis[msg].find{ |d|
              __mock_check_args(d.args, actual_args) }
    __mock_disps_push(defi) # our spies are interested in this
    defi
  else
    Mock.__send__(:raise, # Wrong argument
      Unexpected.new(object, __mock_defis[msg], msg, actual_args))
  end
end

#__mock_verifyObject

used for Muack::Session#verify



7
# File 'lib/muack/stub.rb', line 7

def __mock_verify; true; end