| Class | NotAMock::CallRecorder |
| In: |
lib/not_a_mock/call_recorder.rb
|
| Parent: | Object |
The CallRecorder is a singleton that keeps track of all the call recording hooks installed, and keeps a central record of calls.
| calls | [R] |
An array of recorded calls in chronological order.
Each call is represented by a hash, in this format:
{ :object => example_object, :method => :example_method, :args => ["example argument"], :result => "example result" }
|
# File lib/not_a_mock/call_recorder.rb, line 10
10: def initialize
11: @calls = []
12: @tracked_methods = []
13: end
Return an array of all the calls made to any method of object, in chronological order.
# File lib/not_a_mock/call_recorder.rb, line 22
22: def calls_by_object(object)
23: @calls.select {|call| call[:object] == object }
24: end
Return an array of all the calls made to method of object, in chronological order.
# File lib/not_a_mock/call_recorder.rb, line 27
27: def calls_by_object_and_method(object, method)
28: @calls.select {|call| call[:object] == object && call[:method] == method }
29: end
Remove all patches so that calls are no longer recorded, and clear the call log.
# File lib/not_a_mock/call_recorder.rb, line 60
60: def reset
61: untrack_all
62: @calls = []
63: end