diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-13 08:11:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-13 08:11:20 +0000 |
commit | 8ff33ac9f7819ea157f3045a75ea04963504f35d (patch) | |
tree | 93d4a412496b186039ef57b394ffbcec92ca2768 /test | |
parent | 6ecd90e7ff5cba5c6976062ed01d213a5b46cdfd (diff) | |
download | redmine-8ff33ac9f7819ea157f3045a75ea04963504f35d.tar.gz redmine-8ff33ac9f7819ea157f3045a75ea04963504f35d.zip |
Log email delivery errors (#14403).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12010 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/mailer_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index f66e5763c..c4891678f 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -661,6 +661,29 @@ class MailerTest < ActiveSupport::TestCase assert_include '<tag>', html_part.body.encoded end + 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")) + + ActionMailer::Base.raise_delivery_errors = true + assert_raise Exception, "delivery error" do + mail.deliver + end + ensure + ActionMailer::Base.raise_delivery_errors = false + end + + 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")) + + Rails.logger.expects(:error).with("Email delivery error: delivery error") + ActionMailer::Base.raise_delivery_errors = false + assert_nothing_raised do + mail.deliver + end + end + private def last_email |