aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Mazza <lucastmazza@gmail.com>2014-08-19 23:26:45 -0300
committerLucas Mazza <lucastmazza@gmail.com>2014-08-19 23:26:45 -0300
commit04db4c286888aad1023c05488fe4def876f85e1c (patch)
tree1334ccca8cfadcfceed67ddb22ca76700a638283
parent5d81a7d5f8a966b0da858319e0855b4baa9d4414 (diff)
downloadrails-04db4c286888aad1023c05488fe4def876f85e1c.tar.gz
rails-04db4c286888aad1023c05488fe4def876f85e1c.tar.bz2
rails-04db4c286888aad1023c05488fe4def876f85e1c.zip
Add `set_delivery_method` and `restore_delivery_method` to `ActionMailer::TestCase`.
This way these methods are available outside the ActionMailer test suite, but they are still duplicated inside `test/abstract_unit` for test cases that don't inherit from the `ActionMailer::TestCase` class.
-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 }]