aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-08-19 23:28:51 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-08-19 23:28:51 -0300
commitc8041aba6bc5cac75ada25609d83ba817894065b (patch)
tree1334ccca8cfadcfceed67ddb22ca76700a638283
parent5d81a7d5f8a966b0da858319e0855b4baa9d4414 (diff)
parent04db4c286888aad1023c05488fe4def876f85e1c (diff)
downloadrails-c8041aba6bc5cac75ada25609d83ba817894065b.tar.gz
rails-c8041aba6bc5cac75ada25609d83ba817894065b.tar.bz2
rails-c8041aba6bc5cac75ada25609d83ba817894065b.zip
Merge pull request #16571 from lucasmazza/lm-fix-actionmailer-test-case
Add `set_delivery_method` and `restore_delivery_method` to `ActionMailer::TestCase.
-rw-r--r--actionmailer/lib/action_mailer/test_case.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/actionmailer/lib/action_mailer/test_case.rb b/actionmailer/lib/action_mailer/test_case.rb
index d507032838..b53d2b7fa0 100644
--- a/actionmailer/lib/action_mailer/test_case.rb
+++ b/actionmailer/lib/action_mailer/test_case.rb
@@ -68,6 +68,15 @@ module ActionMailer
ActionMailer::Base.deliveries.clear
end
+ def set_delivery_method(method)
+ @old_delivery_method = ActionMailer::Base.delivery_method
+ ActionMailer::Base.delivery_method = method
+ end
+
+ def restore_delivery_method
+ ActionMailer::Base.delivery_method = @old_delivery_method
+ end
+
def set_expected_mail
@expected = Mail.new
@expected.content_type ["text", "plain", { "charset" => charset }]