From 532a31444188c9ef0a2017d6d12c80ad3425619a Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Fri, 19 Oct 2018 21:09:17 -0600 Subject: [PATCH] Add methods to force failure --- src/spectator/dsl/example_dsl.cr | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/spectator/dsl/example_dsl.cr b/src/spectator/dsl/example_dsl.cr index c13402d..f39e4c9 100644 --- a/src/spectator/dsl/example_dsl.cr +++ b/src/spectator/dsl/example_dsl.cr @@ -11,5 +11,14 @@ module Spectator::DSL macro expect(actual) ::Spectator::Expectations::ValueExpectationPartial.new({{actual.stringify}}, {{actual}}) end + + def fail(reason : String) + raise ExampleFailed.new(reason) + end + + @[AlwaysInline] + def fail + fail("Example failed") + end end end