Class: Muack::Stub
Instance Attribute Summary
Attributes inherited from Mock
Instance Method Summary collapse
-
#__mock_defis_push(defi) ⇒ Object
used for Muack::Modifier#times.
-
#__mock_dispatch(actual_call) ⇒ Object
used for mocked object to dispatch mocked method.
-
#__mock_verify ⇒ Object
used for Muack::Session#verify.
Methods inherited from Mock
#__mock_class, #__mock_defis_pop, #__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_defis_push(defi) ⇒ Object
used for Muack::Modifier#times
10 11 12 13 14 |
# File 'lib/muack/stub.rb', line 10 def __mock_defis_push defi # since stubs never wear out, the reverse ordering would make more sense # so that the latter wins over the previous one (overwrite) __mock_defis[defi.msg].unshift(defi) end |
#__mock_dispatch(actual_call) ⇒ Object
used for mocked object to dispatch mocked method
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/muack/stub.rb', line 17 def __mock_dispatch actual_call defis = __mock_defis[actual_call.msg] if disp = __mock_find_checked_difi(defis, actual_call) # our spies are interested in this __mock_disps_push(actual_call) disp else Mock.__send__(:raise, # Wrong argument Unexpected.new(object, defis, actual_call)) end end |
#__mock_verify ⇒ Object
used for Muack::Session#verify
7 |
# File 'lib/muack/stub.rb', line 7 def __mock_verify; true; end |