From 1be7d30fe05d02381f499079222c72b85fb00478 Mon Sep 17 00:00:00 2001 From: Michael Grosser Date: Sun, 24 Sep 2023 21:18:22 -0700 Subject: [PATCH] add failing test for being unable to cacht throw in around --- spec/cases/around_throw.rb | 10 ++++++++++ spec/maxitest_spec.rb | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 spec/cases/around_throw.rb diff --git a/spec/cases/around_throw.rb b/spec/cases/around_throw.rb new file mode 100644 index 0000000..3fec088 --- /dev/null +++ b/spec/cases/around_throw.rb @@ -0,0 +1,10 @@ +require "./spec/cases/helper" + +describe "2" do + around { |test| catch(:foo) { test.call } } + + it "can throw" do + 1.must_equal 1 + throw :foo + end +end diff --git a/spec/maxitest_spec.rb b/spec/maxitest_spec.rb index d45580b..3daec45 100644 --- a/spec/maxitest_spec.rb +++ b/spec/maxitest_spec.rb @@ -95,6 +95,10 @@ run_cmd("ruby spec/cases/around.rb").should include "\n2 runs, 3 assertions" end + it "can catch in around" do + run_cmd("ruby spec/cases/around_throw.rb").should include "\n1 runs, 1 assertion" + end + it "informs user about missing around :all" do with_env HOOK_TYPE: "all" do out = run_cmd("ruby spec/cases/around.rb", fail: true)