From 162ad4df33bc370e2211286f44d5143e0740ff4e Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 19 Mar 2022 18:58:06 -0600 Subject: [PATCH] Report call and args like other error messages --- src/spectator/mocks/double.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spectator/mocks/double.cr b/src/spectator/mocks/double.cr index 716f2c4..6d8c173 100644 --- a/src/spectator/mocks/double.cr +++ b/src/spectator/mocks/double.cr @@ -127,7 +127,7 @@ module Spectator Log.debug { "Got undefined method `{{call.name}}({{*call.args}}{% if call.named_args %}{% unless call.args.empty? %}, {% end %}{{*call.named_args}}{% end %}){% if call.block %} { ... }{% end %}`" } args = ::Spectator::Arguments.capture({{call.args.splat(", ")}}{% if call.named_args %}{{*call.named_args}}{% end %}) call = ::Spectator::MethodCall.new({{call.name.symbolize}}, args) - raise ::Spectator::UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message :{{call.name}} with #{args}") + raise ::Spectator::UnexpectedMessage.new("#{_spectator_stubbed_name} received unexpected message #{call}") nil # Necessary for compiler to infer return type as nil. Avoids runtime "can't execute ... `x` has no type errors". end end