From 8e83edcc35d913c9ee9253a25f49eafb8eb86d42 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 9 Oct 2022 16:04:07 -0600 Subject: [PATCH] Simpler conditional block inclusion --- src/spectator/dsl/mocks.cr | 2 +- src/spectator/mocks/double.cr | 2 +- src/spectator/mocks/mock.cr | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spectator/dsl/mocks.cr b/src/spectator/dsl/mocks.cr index 628fe6b..94a41f9 100644 --- a/src/spectator/dsl/mocks.cr +++ b/src/spectator/dsl/mocks.cr @@ -38,7 +38,7 @@ module Spectator::DSL {{null_double_type_name}}.new(@stubs) end - {% if block %}{{block.body}}{% end %} + {{block.body if block}} end {% begin %} diff --git a/src/spectator/mocks/double.cr b/src/spectator/mocks/double.cr index ad35dda..b45b9c8 100644 --- a/src/spectator/mocks/double.cr +++ b/src/spectator/mocks/double.cr @@ -61,7 +61,7 @@ module Spectator end {% end %} - {% if block %}{{block.body}}{% end %} + {{block.body if block}} end end diff --git a/src/spectator/mocks/mock.cr b/src/spectator/mocks/mock.cr index 901d088..ba72b37 100644 --- a/src/spectator/mocks/mock.cr +++ b/src/spectator/mocks/mock.cr @@ -84,7 +84,7 @@ module Spectator macro finished stub_type {{mocked_type.id}} - {% if block %}{{block.body}}{% end %} + {{block.body if block}} end end {% end %} @@ -189,7 +189,7 @@ module Spectator macro finished stub_type {{type_name.id}} - {% if block %}{{block.body}}{% end %} + {{block.body if block}} end end {% end %}