From 1a3f663b7050b7aec3017f190052944410341569 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 17 Nov 2019 10:47:51 -0700 Subject: [PATCH] Name is optional for doubles --- src/spectator/dsl/mocks.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spectator/dsl/mocks.cr b/src/spectator/dsl/mocks.cr index fca156d..7470f16 100644 --- a/src/spectator/dsl/mocks.cr +++ b/src/spectator/dsl/mocks.cr @@ -1,7 +1,7 @@ require "../mocks" module Spectator::DSL - macro double(name, **stubs, &block) + macro double(name = "Anonymous", **stubs, &block) {% if name.is_a?(StringLiteral) %} anonymous_double({{name}}, {{stubs.double_splat}}) {% else %} @@ -44,7 +44,7 @@ module Spectator::DSL end end - def anonymous_double(name : String, **stubs) + def anonymous_double(name = "Anonymous", **stubs) Mocks::AnonymousDouble.new(name, stubs) end @@ -91,7 +91,7 @@ module Spectator::DSL end end - def anonymous_null_double(name : String, **stubs) + def anonymous_null_double(name = "Anonymous", **stubs) AnonymousNullDouble.new(name, stubs) end