aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-07-01 20:43:40 +0000
committerJamis Buck <jamis@37signals.com>2005-07-01 20:43:40 +0000
commit5c981528f20d53ad441b61c70350cc53fe3e8b6f (patch)
tree2a3ae0e88c00115116746d81cf1882bb7b6d3b78 /actionmailer/test
parentebd7bf7945d8fc6881a7b576fe22eaaa2ca3efd8 (diff)
downloadrails-5c981528f20d53ad441b61c70350cc53fe3e8b6f.tar.gz
rails-5c981528f20d53ad441b61c70350cc53fe3e8b6f.tar.bz2
rails-5c981528f20d53ad441b61c70350cc53fe3e8b6f.zip
Better multipart support with implicit multipart/alternative and sorting of subparts [John Long]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1586 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rw-r--r--actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml1
-rwxr-xr-xactionmailer/test/mail_service_test.rb18
2 files changed, 16 insertions, 3 deletions
diff --git a/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml
new file mode 100644
index 0000000000..c14348c770
--- /dev/null
+++ b/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml
@@ -0,0 +1 @@
+yaml to: <%= @recipient %> \ No newline at end of file
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 01b71801b8..85fe3ad69b 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -111,12 +111,13 @@ class TestMailer < ActionMailer::Base
:body => "123456789"
end
- def implicitly_multipart_example(recipient)
+ def implicitly_multipart_example(recipient, order = nil)
@recipients = recipient
@subject = "multipart example"
@from = "test@example.com"
@sent_on = Time.local 2004, 12, 12
@body = { "recipient" => recipient }
+ @implicit_parts_order = order unless order.nil?
end
def html_mail(recipient)
@@ -551,11 +552,22 @@ EOF
def test_implicitly_multipart_messages
mail = TestMailer.create_implicitly_multipart_example(@recipient)
- assert_equal 2, mail.parts.length
- assert_equal "text/html", mail.parts[0].content_type
+ assert_equal 3, mail.parts.length
+ assert_equal "multipart/alternative", mail.content_type
+ assert_equal "text/yaml", mail.parts[0].content_type
assert_equal "utf-8", mail.parts[0].sub_header("content-type", "charset")
assert_equal "text/plain", mail.parts[1].content_type
assert_equal "utf-8", mail.parts[1].sub_header("content-type", "charset")
+ assert_equal "text/html", mail.parts[2].content_type
+ assert_equal "utf-8", mail.parts[2].sub_header("content-type", "charset")
+ end
+
+ def test_implicitly_multipart_messages_with_custom_order
+ mail = TestMailer.create_implicitly_multipart_example(@recipient, ["text/yaml", "text/plain"])
+ assert_equal 3, mail.parts.length
+ assert_equal "text/html", mail.parts[0].content_type
+ assert_equal "text/plain", mail.parts[1].content_type
+ assert_equal "text/yaml", mail.parts[2].content_type
end
def test_html_mail