From b0e17e8199bb40d0b1bed2c3dded355f439d8b3a Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sat, 25 May 2019 06:50:25 +0000 Subject: Don't rescue Exception class (#31387). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Go MAEDA and Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@18197 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/issue_nested_set_concurrency_test.rb | 2 +- test/unit/mail_handler_test.rb | 2 +- test/unit/mailer_test.rb | 6 +++--- test/unit/project_nested_set_concurrency_test.rb | 2 +- test/unit/tracker_test.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'test/unit') diff --git a/test/unit/issue_nested_set_concurrency_test.rb b/test/unit/issue_nested_set_concurrency_test.rb index 0a1c38bba..c31aae5b8 100644 --- a/test/unit/issue_nested_set_concurrency_test.rb +++ b/test/unit/issue_nested_set_concurrency_test.rb @@ -84,7 +84,7 @@ class IssueNestedSetConcurrencyTest < ActiveSupport::TestCase ActiveRecord::Base.connection_pool.with_connection do begin yield - rescue Exception => e + rescue => e Thread.current[:exception] = e.message end end diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 61b60434f..40de6bbbc 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -1223,7 +1223,7 @@ class MailHandlerTest < ActiveSupport::TestCase end def test_safe_receive_should_rescue_exceptions_and_return_false - MailHandler.stubs(:receive).raises(Exception.new "Something went wrong") + MailHandler.stubs(:receive).raises(StandardError.new "Something went wrong") assert_equal false, MailHandler.safe_receive end diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index 75890baf3..ad04fbb90 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -920,10 +920,10 @@ class MailerTest < ActiveSupport::TestCase def test_should_raise_delivery_errors_when_raise_delivery_errors_is_true mail = Mailer.test_email(User.find(1)) - mail.delivery_method.stubs(:deliver!).raises(Exception.new("delivery error")) + mail.delivery_method.stubs(:deliver!).raises(StandardError.new("delivery error")) ActionMailer::Base.raise_delivery_errors = true - assert_raise Exception, "delivery error" do + assert_raise StandardError, "delivery error" do mail.deliver end ensure @@ -932,7 +932,7 @@ class MailerTest < ActiveSupport::TestCase def test_should_log_delivery_errors_when_raise_delivery_errors_is_false mail = Mailer.test_email(User.find(1)) - mail.delivery_method.stubs(:deliver!).raises(Exception.new("delivery error")) + mail.delivery_method.stubs(:deliver!).raises(StandardError.new("delivery error")) Rails.logger.expects(:error).with("Email delivery error: delivery error") ActionMailer::Base.raise_delivery_errors = false diff --git a/test/unit/project_nested_set_concurrency_test.rb b/test/unit/project_nested_set_concurrency_test.rb index 715faed0c..dbf936a75 100644 --- a/test/unit/project_nested_set_concurrency_test.rb +++ b/test/unit/project_nested_set_concurrency_test.rb @@ -52,7 +52,7 @@ class ProjectNestedSetConcurrencyTest < ActiveSupport::TestCase c2.reload.destroy c1.reload.destroy end - rescue Exception => e + rescue => e Thread.current[:exception] = e.message end end diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb index 4cace7e3b..62ac35afb 100644 --- a/test/unit/tracker_test.rb +++ b/test/unit/tracker_test.rb @@ -129,7 +129,7 @@ class TrackerTest < ActiveSupport::TestCase tracker = Tracker.find(1) assert_no_difference 'Tracker.count' do - assert_raise Exception do + assert_raise StandardError do tracker.destroy end end -- cgit v1.2.3