Class: Mocktail::CollectsCalls

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mocktail/collects_calls.rb,
lib/mocktail/sorbet/mocktail/collects_calls.rb

Instance Method Summary collapse

Instance Method Details

#collect(double, method_name) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/mocktail/collects_calls.rb', line 5

def collect(double, method_name)
  calls = ExplainsThing.new.explain(double).reference.calls

  if method_name.nil?
    calls
  else
    calls.select { |call| call.method.to_s == method_name.to_s }
  end
end