aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-26 16:00:24 +0100
committerJosé Valim and Mikel Lindsaar <pair@programming.com>2010-01-26 16:00:24 +0100
commit05c4ad9d3f6ff8d0017f4bca9b52e552629c4813 (patch)
treef10925404cd39ae045a57b5a067fa6896d2ebc6e /actionmailer
parentccea6ab07d38c5bc2de341c3f08d199ef55bccc6 (diff)
downloadrails-05c4ad9d3f6ff8d0017f4bca9b52e552629c4813.tar.gz
rails-05c4ad9d3f6ff8d0017f4bca9b52e552629c4813.tar.bz2
rails-05c4ad9d3f6ff8d0017f4bca9b52e552629c4813.zip
Tidy up tests and docs.
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb4
-rw-r--r--actionmailer/test/base_test.rb37
2 files changed, 21 insertions, 20 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 669e49c91c..b230e34631 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -360,8 +360,8 @@ module ActionMailer #:nodoc:
# You can also pass a hash into headers of header field names and values, which
# will then be set on the Mail::Message object:
#
- # headers {'X-Special-Domain-Specific-Header' => "SecretValue",
- # 'In-Reply-To' => incoming.message_id }
+ # headers 'X-Special-Domain-Specific-Header' => "SecretValue",
+ # 'In-Reply-To' => incoming.message_id
#
# The resulting Mail::Message will have the following in it's header:
#
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 0709c92326..4a65363e3e 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -79,7 +79,7 @@ class BaseTest < ActiveSupport::TestCase
# Basic mail usage without block
test "mail() should set the headers of the mail message" do
email = BaseMailer.welcome
- assert_equal(['system@test.lindsaar.net'], email.to)
+ assert_equal(['system@test.lindsaar.net'], email.to)
assert_equal(['jose@test.plataformatec.com'], email.from)
assert_equal('The first email on new API!', email.subject)
end
@@ -126,6 +126,22 @@ class BaseTest < ActiveSupport::TestCase
assert_equal("Not SPAM", email['X-SPAM'].decoded)
end
+ test "can pass random headers in as a hash to mail" do
+ hash = {'X-Special-Domain-Specific-Header' => "SecretValue",
+ 'In-Reply-To' => '1234@mikel.me.com' }
+ mail = BaseMailer.simple(hash)
+ assert_equal('SecretValue', mail['X-Special-Domain-Specific-Header'].decoded)
+ assert_equal('1234@mikel.me.com', mail['In-Reply-To'].decoded)
+ end
+
+ test "can pass random headers in as a hash" do
+ hash = {'X-Special-Domain-Specific-Header' => "SecretValue",
+ 'In-Reply-To' => '1234@mikel.me.com' }
+ mail = BaseMailer.simple_with_headers(hash)
+ assert_equal('SecretValue', mail['X-Special-Domain-Specific-Header'].decoded)
+ assert_equal('1234@mikel.me.com', mail['In-Reply-To'].decoded)
+ end
+
# Attachments
test "attachment with content" do
email = BaseMailer.attachment_with_content
@@ -397,7 +413,8 @@ class BaseTest < ActiveSupport::TestCase
test "calling deliver on the action should deliver the mail object" do
BaseMailer.deliveries.clear
BaseMailer.expects(:deliver_mail).once
- BaseMailer.welcome.deliver
+ mail = BaseMailer.welcome.deliver
+ assert_instance_of Mail::Message, mail
end
test "calling deliver on the action should increment the deliveries collection" do
@@ -417,22 +434,6 @@ class BaseTest < ActiveSupport::TestCase
mail = BaseMailer.explicit_multipart
assert_not_nil(mail.content_type_parameters[:boundary])
end
-
- test "can pass random headers in as a hash" do
- hash = {'X-Special-Domain-Specific-Header' => "SecretValue",
- 'In-Reply-To' => '1234@mikel.me.com' }
- mail = BaseMailer.simple_with_headers(hash)
- assert_equal('SecretValue', mail['X-Special-Domain-Specific-Header'].decoded)
- assert_equal('1234@mikel.me.com', mail['In-Reply-To'].decoded)
- end
-
- test "can pass random headers in as a hash to mail" do
- hash = {'X-Special-Domain-Specific-Header' => "SecretValue",
- 'In-Reply-To' => '1234@mikel.me.com' }
- mail = BaseMailer.simple(hash)
- assert_equal('SecretValue', mail['X-Special-Domain-Specific-Header'].decoded)
- assert_equal('1234@mikel.me.com', mail['In-Reply-To'].decoded)
- end
protected