Match RSpec double name string

This commit is contained in:
Michael Miller 2022-03-03 22:41:18 -07:00
parent 9594604770
commit 7e65d94cee
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2

View file

@ -8,9 +8,9 @@ module Spectator
# Utility returning the double's name as a string. # Utility returning the double's name as a string.
private def _spectator_double_name : String private def _spectator_double_name : String
if name = @name if name = @name
"\"#{name}\"" "#<Double #{name.inspect}>"
else else
"Anonymous" "#<Double Anonymous>"
end end
end end
@ -36,7 +36,7 @@ module Spectator
@messages[{{meth.name.symbolize}}] @messages[{{meth.name.symbolize}}]
{% end %} {% end %}
\{% else %} \{% else %}
raise UnexpectedMessage.new("Double<#{_spectator_double_name}> received unexpected message :{{meth.name}} (masking ancestor) with (<TODO: ARGS>).") raise UnexpectedMessage.new("#{_spectator_double_name} received unexpected message :{{meth.name}} (masking ancestor) with (<TODO: ARGS>).")
\{% end %} \{% end %}
end end
{% end %} {% end %}
@ -61,7 +61,7 @@ module Spectator
@messages[{{meth.name.symbolize}}] @messages[{{meth.name.symbolize}}]
{% end %} {% end %}
\{% else %} \{% else %}
raise UnexpectedMessage.new("Double<#{_spectator_double_name}> received unexpected message :{{meth.name}} (masking ancestor) with (<TODO: ARGS>).") raise UnexpectedMessage.new("#{_spectator_double_name} received unexpected message :{{meth.name}} (masking ancestor) with (<TODO: ARGS>).")
\{% end %} \{% end %}
end end
{% end %} {% end %}
@ -86,7 +86,7 @@ module Spectator
@messages[{{meth.name.symbolize}}] @messages[{{meth.name.symbolize}}]
{% end %} {% end %}
\{% else %} \{% else %}
raise UnexpectedMessage.new("Double<#{_spectator_double_name}> received unexpected message :{{meth.name}} (masking ancestor) with (<TODO: ARGS>).") raise UnexpectedMessage.new("#{_spectator_double_name} received unexpected message :{{meth.name}} (masking ancestor) with (<TODO: ARGS>).")
\{% end %} \{% end %}
end end
{% end %} {% end %}
@ -97,7 +97,7 @@ module Spectator
\{% if Messages.keys.includes?({{call.name.symbolize}}.id) %} \{% if Messages.keys.includes?({{call.name.symbolize}}.id) %}
@messages[{{call.name.symbolize}}] @messages[{{call.name.symbolize}}]
\{% else %} \{% else %}
raise UnexpectedMessage.new("Double<#{_spectator_double_name}> received unexpected message :{{call.name}} with (<TODO: ARGS>).") raise UnexpectedMessage.new("#{_spectator_double_name} received unexpected message :{{call.name}} with (<TODO: ARGS>).")
\{% end %} \{% end %}
end end
end end