diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-11-29 02:52:49 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-11-29 02:52:49 +0000 |
commit | 1d32cec17d768ac78d52903f5ed8b19cc37c7f78 (patch) | |
tree | f8149c5e29a8ad85eed0332c79b76fa62e15d899 /actionmailer/test | |
parent | fd3f048f6dda74193644e2bbb23044e64df84449 (diff) | |
download | rails-1d32cec17d768ac78d52903f5ed8b19cc37c7f78.tar.gz rails-1d32cec17d768ac78d52903f5ed8b19cc37c7f78.tar.bz2 rails-1d32cec17d768ac78d52903f5ed8b19cc37c7f78.zip |
Allow body to be specified for nested parts with action mailer. Closes #10271 [redinger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8238 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rwxr-xr-x | actionmailer/test/mail_service_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 09132ed7e6..ad2e8afd2b 100755 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -210,6 +210,16 @@ class TestMailer < ActionMailer::Base attachment :content_type => "application/octet-stream",:filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz" end + def nested_multipart_with_body(recipient) + recipients recipient + subject "nested multipart with body" + from "test@example.com" + content_type "multipart/mixed" + part :content_type => "multipart/alternative", :content_disposition => "inline", :body => "Nothing to see here." do |p| + p.part :content_type => "text/html", :body => "<b>test</b> HTML<br/>" + end + end + def attachment_with_custom_header(recipient) recipients recipient subject "custom header in attachment" @@ -310,6 +320,19 @@ class ActionMailerTest < Test::Unit::TestCase assert_equal "application/octet-stream", created.parts[1].content_type end + def test_nested_parts_with_body + created = nil + assert_nothing_raised { created = TestMailer.create_nested_multipart_with_body(@recipient)} + assert_equal 1,created.parts.size + assert_equal 2,created.parts.first.parts.size + + assert_equal "multipart/mixed", created.content_type + assert_equal "multipart/alternative", created.parts.first.content_type + assert_equal "Nothing to see here.", created.parts.first.parts.first.body + assert_equal "text/plain", created.parts.first.parts.first.content_type + assert_equal "text/html", created.parts.first.parts[1].content_type + end + def test_attachment_with_custom_header created = nil assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient)} |