diff options
author | Matthew Rudy Jacobs <MatthewRudyJacobs@gmail.com> | 2009-10-28 09:17:59 +0000 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-11-01 02:23:47 +0100 |
commit | f4f76772fb5c25357a54baaa9cd20f7e9a1cd653 (patch) | |
tree | c3095ca798d006fa5750538d862cf5fcc35da6ba /actionmailer/test/mail_service_test.rb | |
parent | 3f560386125adabe441facf2514ad53425e4af4e (diff) | |
download | rails-f4f76772fb5c25357a54baaa9cd20f7e9a1cd653.tar.gz rails-f4f76772fb5c25357a54baaa9cd20f7e9a1cd653.tar.bz2 rails-f4f76772fb5c25357a54baaa9cd20f7e9a1cd653.zip |
abstract all of the ActionMailer delivery methods into their own classes. thereby the following are equivalent
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.delivery_method = ActionMailer::DeliveryMethod::Smtp
we could equally set our own custom object
as long as it provides the instance method :perform_delivery(mail)
eg.
class MySmsDeliveryMethod
def perform_delivery(mail)
Sms.send(mail['to'], mail['body'])
end
end
MySmsMailer.delivery_method = MySmsDeliveryMethod.new
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionmailer/test/mail_service_test.rb')
-rw-r--r-- | actionmailer/test/mail_service_test.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 5584afa8be..802c2b37d4 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -554,7 +554,7 @@ class ActionMailerTest < Test::Unit::TestCase def test_doesnt_raise_errors_when_raise_delivery_errors_is_false ActionMailer::Base.raise_delivery_errors = false - TestMailer.any_instance.expects(:perform_delivery_test).raises(Exception) + TestMailer.delivery_method.expects(:perform_delivery).raises(Exception) assert_nothing_raised { TestMailer.deliver_signed_up(@recipient) } end |