From 151926fd25dd88e9d2b4c8fb157c9f7e3139080f Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 12 Mar 2022 14:31:39 -0700 Subject: [PATCH] Fix captured arguments not handling splat --- src/spectator/mocks/stubable.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spectator/mocks/stubable.cr b/src/spectator/mocks/stubable.cr index ba9255a..97368c0 100644 --- a/src/spectator/mocks/stubable.cr +++ b/src/spectator/mocks/stubable.cr @@ -12,7 +12,7 @@ module Spectator {% if method.block_arg %}&{{method.block_arg}}{% elsif method.accepts_block? %}&{% end %} ){% if method.return_type %} : {{method.return_type}}{% end %}{% if !method.free_vars.empty? %} forall {{method.free_vars.splat}}{% end %} %args = ::Spectator::Arguments.capture( - {{method.args.map(&.internal_name).splat(",")}} + {% for arg, i in method.args %}{% if i == method.splat_index %}*{% end %}{{arg.internal_name}}, {% end %} {% if method.double_splat %}**{{method.double_splat}}{% end %} ) %call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args) @@ -50,7 +50,7 @@ module Spectator {% if method.block_arg %}&{{method.block_arg}}{% elsif method.accepts_block? %}&{% end %} ){% if method.return_type %} : {{method.return_type}}{% end %}{% if !method.free_vars.empty? %} forall {{method.free_vars.splat}}{% end %} %args = ::Spectator::Arguments.capture( - {{method.args.map(&.internal_name).splat(",")}} + {% for arg, i in method.args %}{% if i == method.splat_index %}*{% end %}{{arg.internal_name}}, {% end %} {% if method.double_splat %}**{{method.double_splat}}{% end %} ) %call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args)