Class: Synthesis::MethodInvocationWatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/synthesis/method_invocation_watcher.rb

Class Method Summary collapse

Class Method Details

.invoked(receiver, method, args = [], return_values = []) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/synthesis/method_invocation_watcher.rb', line 3

def self.invoked(receiver, method, args = [], return_values = [])
  # cal = caller.clone
  # cal.shift # ignore first (eval)
  # path_from_spec = []
  # begin
  #   c = cal.shift
  #   path_from_spec.unshift c # unless c =~ /(\(eval\)|gems)/
  # end until c =~ /(spec|test)/
  matcher = Expectation.new(receiver, method, nil, args, return_values)
  ExpectationRecord[matcher].invoked! # path_from_spec
end