From 747d56881a07d4636fbaceb1542579d5e02daddd Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sun, 22 Nov 2009 23:20:57 +1100 Subject: 131 tests, 309 assertions, 0 failures, 0 errors --- actionmailer/test/mail_service_test.rb | 66 +++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 29 deletions(-) (limited to 'actionmailer/test/mail_service_test.rb') diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 6ed7f20837..c4d664d7e5 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -232,7 +232,7 @@ class TestMailer < ActionMailer::Base p.part :content_type => "text/html", :body => "test HTML
\nline #2" end - attachment :content_type => "application/octet-stream",:filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz" + attachment :content_type => "application/octet-stream", :filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz" end def nested_multipart_with_body(recipient) @@ -346,36 +346,38 @@ class ActionMailerTest < Test::Unit::TestCase def test_nested_parts created = nil assert_nothing_raised { created = TestMailer.create_nested_multipart(@recipient)} - assert_equal 2,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 "bar", created.parts.first.header['foo'].to_s - assert_nil created.parts.first.charset - assert_equal "text/plain", created.parts.first.parts.first.content_type - assert_equal "text/html", created.parts.first.parts[1].content_type - assert_equal "application/octet-stream", created.parts[1].content_type + assert_equal 2, created.parts.size + assert_equal 2, created.parts.first.parts.size + + assert_equal "multipart/mixed", created.content_type.string + assert_equal "multipart/alternative", created.parts[0].content_type.string + assert_equal "bar", created.parts[0].header['foo'].decoded + assert_nil created.parts[0].charset + assert_equal "text/plain", created.parts[0].parts[0].content_type.string + assert_equal "text/html", created.parts[0].parts[1].content_type.string + assert_equal "application/octet-stream", created.parts[1].content_type.string + end def test_nested_parts_with_body created = nil TestMailer.create_nested_multipart_with_body(@recipient) 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 + assert_equal "multipart/mixed", created.content_type.string + assert_equal "multipart/alternative", created.parts.first.content_type.string + assert_equal "text/plain", created.parts.first.parts.first.content_type.string + assert_equal "Nothing to see here.", created.parts.first.parts.first.body.decoded + assert_equal "text/html", created.parts.first.parts.second.content_type.string + assert_equal "test HTML
", created.parts.first.parts.second.body.decoded end def test_attachment_with_custom_header created = nil assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient) } - created.encoded assert created.parts.any? { |p| p.header['content-id'].to_s == "" } end @@ -817,7 +819,7 @@ EOF created = TestMailer.create_utf8_body @recipient assert_match(/\nFrom: =\?utf-8\?Q\?Foo_.*?\?= \r/, created.encoded) - assert_match(/\nTo: =\?utf-8\?Q\?Foo_.*?\?= , Example Recipient , \r\n\tExample Recipient }, MockSMTP.deliveries[0][0] + assert_match %r{^Return-Path: another@somewhere.test}, MockSMTP.deliveries[0][0] assert_equal "another@somewhere.test", MockSMTP.deliveries[0][1].to_s end -- cgit v1.2.3