An expectation recorder records any expectations received and plays them back on demand. This is used to collect the expectations in the blockless version of the new_instances call.
Methods
Public Class methods
Initialize the recorder.
[ show source ]
# File lib/flexmock/expectation.rb, line 456
456: def initialize
457: @expectations = []
458: end
Public Instance methods
Apply the recorded messages to the given object in a chaining fashion (i.e. the result of the previous call is used as the target of the next call).
[ show source ]
# File lib/flexmock/expectation.rb, line 469
469: def apply(mock)
470: obj = mock
471: @expectations.each do |sym, args, block|
472: obj = obj.send(sym, *args, &block)
473: end
474: end
Save any incoming messages to be played back later.
[ show source ]
# File lib/flexmock/expectation.rb, line 461
461: def method_missing(sym, *args, &block)
462: @expectations << [sym, args, block]
463: self
464: end