@@ -210,6 +210,16 @@ def nested_multipart(recipient)
210210 attachment :content_type => "application/octet-stream" , :filename => "test.txt" , :body => "test abcdefghijklmnopqstuvwxyz"
211211 end
212212
213+ def nested_multipart_with_body ( recipient )
214+ recipients recipient
215+ subject "nested multipart with body"
216+ 217+ content_type "multipart/mixed"
218+ part :content_type => "multipart/alternative" , :content_disposition => "inline" , :body => "Nothing to see here." do |p |
219+ p . part :content_type => "text/html" , :body => "<b>test</b> HTML<br/>"
220+ end
221+ end
222+
213223 def attachment_with_custom_header ( recipient )
214224 recipients recipient
215225 subject "custom header in attachment"
@@ -310,6 +320,19 @@ def test_nested_parts
310320 assert_equal "application/octet-stream" , created . parts [ 1 ] . content_type
311321 end
312322
323+ def test_nested_parts_with_body
324+ created = nil
325+ assert_nothing_raised { created = TestMailer . create_nested_multipart_with_body ( @recipient ) }
326+ assert_equal 1 , created . parts . size
327+ assert_equal 2 , created . parts . first . parts . size
328+
329+ assert_equal "multipart/mixed" , created . content_type
330+ assert_equal "multipart/alternative" , created . parts . first . content_type
331+ assert_equal "Nothing to see here." , created . parts . first . parts . first . body
332+ assert_equal "text/plain" , created . parts . first . parts . first . content_type
333+ assert_equal "text/html" , created . parts . first . parts [ 1 ] . content_type
334+ end
335+
313336 def test_attachment_with_custom_header
314337 created = nil
315338 assert_nothing_raised { created = TestMailer . create_attachment_with_custom_header ( @recipient ) }
0 commit comments