diff options
author | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-24 19:36:42 +0100 |
---|---|---|
committer | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-24 19:36:42 +0100 |
commit | bd96614101262e0ad0cc176ed8e2d95a5c17936b (patch) | |
tree | 1612a3baaf634bd180b2b145db12b7eeb3096010 /actionmailer/lib/action_mailer/delivery_methods.rb | |
parent | 99f960a3d73b62a957988bbee0906264f35afc2e (diff) | |
download | rails-bd96614101262e0ad0cc176ed8e2d95a5c17936b.tar.gz rails-bd96614101262e0ad0cc176ed8e2d95a5c17936b.tar.bz2 rails-bd96614101262e0ad0cc176ed8e2d95a5c17936b.zip |
Move old tests to a specific folder and add some delivery method tests.
Diffstat (limited to 'actionmailer/lib/action_mailer/delivery_methods.rb')
-rw-r--r-- | actionmailer/lib/action_mailer/delivery_methods.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index 38325e512f..21909d5d57 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -1,7 +1,8 @@ require 'tmpdir' module ActionMailer - # Provides a DSL for adding delivery methods to ActionMailer. + # This modules handles everything related to the delivery, from registering new + # delivery methods to configuring the mail object to be send. module DeliveryMethods extend ActiveSupport::Concern @@ -9,6 +10,13 @@ module ActionMailer extlib_inheritable_accessor :delivery_methods, :delivery_method, :instance_writer => false + # Do not make this inheritable, because we always want it to propagate + cattr_accessor :raise_delivery_errors + self.raise_delivery_errors = true + + cattr_accessor :perform_deliveries + self.perform_deliveries = true + self.delivery_methods = {} self.delivery_method = :smtp @@ -32,6 +40,9 @@ module ActionMailer end module ClassMethods + # Provides a list of emails that have been delivered by Mail + delegate :deliveries, :deliveries=, :to => Mail + # Adds a new delivery method through the given class using the given symbol # as alias and the default options supplied: # @@ -50,7 +61,8 @@ module ActionMailer self.delivery_methods[symbol.to_sym] = klass end - def wrap_delivery_behavior(mail, method=delivery_method) #:nodoc: + def wrap_delivery_behavior(mail, method=nil) #:nodoc: + method ||= self.delivery_method mail.register_for_delivery_notification(self) if method.is_a?(Symbol) |