From 6b85bb7ed75160da35472b65710be98e13651ffa Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 5 Oct 2019 22:42:33 -0600 Subject: [PATCH] Default raise if stub is called without defintion --- src/spectator/double.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/spectator/double.cr b/src/spectator/double.cr index 8e4237d..aeed0c1 100644 --- a/src/spectator/double.cr +++ b/src/spectator/double.cr @@ -5,7 +5,11 @@ module Spectator private class Internal def {{definition.name.id}}({{definition.args.splat}}) - {{definition.block.body}} + {% if definition.block.is_a?(Nop) %} + raise "Stubbed method called without being allowed" + {% else %} + {{definition.block.body}} + {% end %} end end end