aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer
diff options
context:
space:
mode:
authorJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-24 19:36:42 +0100
committerJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-24 19:36:42 +0100
commitbd96614101262e0ad0cc176ed8e2d95a5c17936b (patch)
tree1612a3baaf634bd180b2b145db12b7eeb3096010 /actionmailer/lib/action_mailer
parent99f960a3d73b62a957988bbee0906264f35afc2e (diff)
downloadrails-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')
-rw-r--r--actionmailer/lib/action_mailer/base.rb10
-rw-r--r--actionmailer/lib/action_mailer/delivery_methods.rb16
-rw-r--r--actionmailer/lib/action_mailer/mail_helper.rb2
3 files changed, 16 insertions, 12 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 7e984124b7..1b81cbf5af 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -256,6 +256,7 @@ module ActionMailer #:nodoc:
include DeliveryMethods, Quoting
abstract!
+ # TODO Add some sanity tests for the included modules
include AbstractController::Logger
include AbstractController::Rendering
include AbstractController::LocalizedCache
@@ -270,12 +271,6 @@ module ActionMailer #:nodoc:
private_class_method :new #:nodoc:
- cattr_accessor :raise_delivery_errors
- @@raise_delivery_errors = true
-
- cattr_accessor :perform_deliveries
- @@perform_deliveries = true
-
extlib_inheritable_accessor :default_charset
self.default_charset = "utf-8"
@@ -295,9 +290,6 @@ module ActionMailer #:nodoc:
self.default_implicit_parts_order = [ "text/plain", "text/enriched", "text/html" ]
class << self
- # Provides a list of emails that have been delivered by Mail
- delegate :deliveries, :deliveries=, :to => Mail
-
def mailer_name
@mailer_name ||= name.underscore
end
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)
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb
index adba94cbef..01da954b03 100644
--- a/actionmailer/lib/action_mailer/mail_helper.rb
+++ b/actionmailer/lib/action_mailer/mail_helper.rb
@@ -23,7 +23,7 @@ module ActionMailer
# Access the message instance.
def message #:nodoc:
- @message
+ @_message
end
end
end