diff options
author | Dmitry Polushkin <dmitry.polushkin@gmail.com> | 2014-02-09 18:41:41 +0000 |
---|---|---|
committer | Dmitry Polushkin <dmitry.polushkin@gmail.com> | 2014-02-09 18:41:41 +0000 |
commit | 5af7cab02ddd95e6813738e9de69b64fe560dbcd (patch) | |
tree | bd6ea0f1b537d29b7265e536f20989c5b00d2b65 /actionmailer/test | |
parent | ec43584431f61ad56f335033b650a906f44fbf40 (diff) | |
download | rails-5af7cab02ddd95e6813738e9de69b64fe560dbcd.tar.gz rails-5af7cab02ddd95e6813738e9de69b64fe560dbcd.tar.bz2 rails-5af7cab02ddd95e6813738e9de69b64fe560dbcd.zip |
add actionmailer test coverage for undefined delivery method
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/delivery_methods_test.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/actionmailer/test/delivery_methods_test.rb b/actionmailer/test/delivery_methods_test.rb index 20412c7bb2..609903620b 100644 --- a/actionmailer/test/delivery_methods_test.rb +++ b/actionmailer/test/delivery_methods_test.rb @@ -38,8 +38,10 @@ class DefaultsDeliveryMethodsTest < ActiveSupport::TestCase end test "default sendmail settings" do - settings = {location: '/usr/sbin/sendmail', - arguments: '-i -t'} + settings = { + location: '/usr/sbin/sendmail', + arguments: '-i -t' + } assert_equal settings, ActionMailer::Base.sendmail_settings end end @@ -138,13 +140,15 @@ class MailDeliveryTest < ActiveSupport::TestCase end test "default delivery options can be overridden per mail instance" do - settings = { address: "localhost", - port: 25, - domain: 'localhost.localdomain', - user_name: nil, - password: nil, - authentication: nil, - enable_starttls_auto: true } + settings = { + address: "localhost", + port: 25, + domain: 'localhost.localdomain', + user_name: nil, + password: nil, + authentication: nil, + enable_starttls_auto: true + } assert_equal settings, ActionMailer::Base.smtp_settings overridden_options = {user_name: "overridden", password: "somethingobtuse"} mail_instance = DeliveryMailer.welcome(delivery_method_options: overridden_options) @@ -164,6 +168,13 @@ class MailDeliveryTest < ActiveSupport::TestCase end end + test "undefined delivery methods raises errors" do + DeliveryMailer.delivery_method = nil + assert_raise RuntimeError do + DeliveryMailer.welcome.deliver + end + end + test "does not perform deliveries if requested" do DeliveryMailer.perform_deliveries = false DeliveryMailer.deliveries.clear |