test/unit/assertions/assert_raises_tests.rb in assert-2.18.3 vs test/unit/assertions/assert_raises_tests.rb in assert-2.18.4

- old
+ new

@@ -4,24 +4,23 @@ module Assert::Assertions class AssertRaisesTests < Assert::Context include Assert::Test::TestHelpers desc "`assert_raises`" - subject { test1 } - - let(:desc1) { "assert raises fail desc" } - let(:test1) { + subject { desc = desc1 Factory.test do assert_raises(StandardError, RuntimeError) { raise(StandardError) } # pass assert_raises(StandardError, RuntimeError, desc) { raise(Exception) } # fail assert_raises(RuntimeError, desc) { raise(StandardError) } # fail assert_raises(RuntimeError, desc) { true } # fail assert_raises(desc) { true } # fail end } + let(:desc1) { "assert raises fail desc" } + should "produce results as expected" do subject.run(&test_run_callback) assert_that(test_run_result_count).equals(5) assert_that(test_run_result_count(:pass)).equals(1) @@ -60,21 +59,20 @@ class AssertNothingRaisedTests < Assert::Context include Assert::Test::TestHelpers desc "`assert_nothing_raised`" - subject { test1 } - - let(:desc1) { "assert nothing raised fail desc" } - let(:test1) { + subject { desc = desc1 Factory.test do assert_nothing_raised(StandardError, RuntimeError, desc) { raise(StandardError) } # fail assert_nothing_raised(RuntimeError) { raise(StandardError) } # pass assert_nothing_raised(desc) { raise(RuntimeError) } # fail assert_nothing_raised { true } # pass end } + + let(:desc1) { "assert nothing raised fail desc" } should "produce results as expected" do subject.run(&test_run_callback) assert_that(test_run_result_count).equals(4)