Method: Object#track_methods
- Defined in:
- lib/not_a_mock/object_extensions.rb
#track_methods(*methods) ⇒ Object Also known as: track_method, log_calls_to
Call this on any object or class with a list of method names. Any future calls to those methods will be recorded in NotAMock::CallRecorder.
See NotAMock::Matchers for info on how to test which methods have been called, with what arguments, etc.
8 9 10 11 12 13 14 15 16 |
# File 'lib/not_a_mock/object_extensions.rb', line 8 def track_methods(*methods) if methods.empty? self.public_methods(false).map {|method_name| methods << method_name.to_s.to_sym} end methods.each do |method| NotAMock::CallRecorder.instance.track_method(self, method) end end |