Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moving AS::Notifications call to one location in base

  • Loading branch information...
commit afc758297c553de467b0c434330cb703d62795f1 1 parent 258ca14
José Valim and Mikel Lindsaar authored
16 actionmailer/lib/action_mailer/deprecated_api.rb
View
@@ -83,19 +83,17 @@ module ClassMethods
# email.set_some_obscure_header "frobnicate"
# MyMailer.deliver(email)
def deliver(mail)
+ return if @mail_was_called
raise "no mail object available for delivery!" unless mail
- ActiveSupport::Notifications.instrument("action_mailer.deliver", :mailer => self.name) do |payload|
- self.set_payload_for_mail(payload, mail)
+ mail.register_for_delivery_notification(self)
- mail.delivery_method delivery_methods[delivery_method],
- delivery_settings[delivery_method]
-
- mail.raise_delivery_errors = raise_delivery_errors
- mail.perform_deliveries = perform_deliveries
- mail.deliver
- end
+ mail.delivery_method delivery_methods[delivery_method],
+ delivery_settings[delivery_method]
+ mail.raise_delivery_errors = raise_delivery_errors
+ mail.perform_deliveries = perform_deliveries
+ mail.deliver
mail
end
7 actionmailer/test/base_test.rb
View
@@ -325,15 +325,12 @@ def explicit_multipart_with_any(hash = {})
end
test "ActionMailer should be told when Mail gets delivered" do
+ BaseMailer.deliveries.clear
BaseMailer.expects(:delivered_email).once
email = BaseMailer.deliver_welcome
+ assert_equal(1, BaseMailer.deliveries.length)
end
- # test "ActionMailer should be told when Mail gets delivered using new API" do
- # BaseMailer.expects(:delivered_email).once
- # email = BaseMailer.welcome.deliver
- # end
-
protected
# Execute the block setting the given values and restoring old values after
Please sign in to comment.
Something went wrong with that request. Please try again.