Remove _spectator_calls method with filter

This commit is contained in:
Michael Miller 2022-06-28 23:02:46 -06:00
parent 3589f23475
commit 8aed5027aa
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2
6 changed files with 5 additions and 12 deletions

View file

@ -355,7 +355,7 @@ Spectator.describe Spectator::Double do
it "stores arguments for a call" do
dbl.foo(42)
args = Spectator::Arguments.capture(42)
call = dbl._spectator_calls(:foo).first
call = dbl._spectator_calls.first
expect(call.arguments).to eq(args)
end
end

View file

@ -297,7 +297,7 @@ Spectator.describe Spectator::LazyDouble do
it "stores arguments for a call" do
dbl.foo(42)
args = Spectator::Arguments.capture(42)
call = dbl._spectator_calls(:foo).first
call = dbl._spectator_calls.first
expect(call.arguments).to eq(args)
end
end

View file

@ -324,7 +324,7 @@ Spectator.describe Spectator::NullDouble do
it "stores arguments for a call" do
dbl.foo(42)
args = Spectator::Arguments.capture(42)
call = dbl._spectator_calls(:foo).first
call = dbl._spectator_calls.first
expect(call.arguments).to eq(args)
end
end

View file

@ -121,10 +121,6 @@ module Spectator
@calls
end
def _spectator_calls(method : Symbol) : Enumerable(MethodCall)
@calls.select { |call| call.method == method }
end
# Returns the double's name formatted for user output.
private def _spectator_stubbed_name : String
{% if anno = @type.annotation(StubbedName) %}

View file

@ -22,9 +22,6 @@ module Spectator
# Retrieves an mutable collection of stubs.
abstract def _spectator_stubs
# Retrieves an mutable collection of calls to stubs.
abstract def _spectator_calls
def _spectator_define_stub(stub : ::Spectator::Stub) : Nil
_spectator_stubs.unshift(stub)
end

View file

@ -34,8 +34,8 @@ module Spectator
# Saves a call that was made to a stubbed method.
abstract def _spectator_record_call(call : MethodCall) : Nil
# Retrieves all previously saved calls for the specified method.
abstract def _spectator_calls(method : Symbol) : Enumerable(MethodCall)
# Retrieves all previously saved calls.
abstract def _spectator_calls
# Method called when a stub isn't found.
#