From 63002ba36b858ca2aea814579193db9e1511d1fd Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sun, 28 Mar 2010 15:24:35 +1100 Subject: Fixing test, ; is a delimiter, not a termination character, ref RFC 2045 --- actionmailer/test/old_base/mail_service_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/old_base/mail_service_test.rb b/actionmailer/test/old_base/mail_service_test.rb index e49307bfda..8a677df9a8 100644 --- a/actionmailer/test/old_base/mail_service_test.rb +++ b/actionmailer/test/old_base/mail_service_test.rb @@ -1019,8 +1019,8 @@ EOF def test_empty_header_values_omitted result = TestMailer.unnamed_attachment(@recipient).encoded - assert_match %r{Content-Type: application/octet-stream;}, result - assert_match %r{Content-Disposition: attachment;}, result + assert_match %r{Content-Type: application/octet-stream}, result + assert_match %r{Content-Disposition: attachment}, result end def test_headers_with_nonalpha_chars -- cgit v1.2.3 From a41d1b1fb168ee248749444590050f120378afe1 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sun, 28 Mar 2010 16:22:37 +1100 Subject: Updating test, should be calling :decoded, not :encoded, is a problem now that Mail is fixed --- actionmailer/test/old_base/mail_service_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/old_base/mail_service_test.rb b/actionmailer/test/old_base/mail_service_test.rb index 8a677df9a8..9eb067554f 100644 --- a/actionmailer/test/old_base/mail_service_test.rb +++ b/actionmailer/test/old_base/mail_service_test.rb @@ -784,7 +784,7 @@ EOF expected.date = Time.local 2004, 12, 12 created = TestMailer.utf8_body @recipient - assert_match(/åœö blah/, created.encoded) + assert_match(/åœö blah/, created.decoded) end def test_multiple_utf8_recipients -- cgit v1.2.3 From b91c57d16cc1b7b686e5ecc208dfe08648360803 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sun, 28 Mar 2010 16:24:54 +1100 Subject: Mail now correctly bundles up the charset into the content type field --- actionmailer/test/base_test.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 6f274c11df..aa28c5aa8b 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -135,13 +135,13 @@ class BaseTest < ActiveSupport::TestCase :mime_version => '2.0', :reply_to => 'reply-to@test.lindsaar.net', :date => @time) - assert_equal(['bcc@test.lindsaar.net'], email.bcc) - assert_equal(['cc@test.lindsaar.net'], email.cc) - assert_equal('multipart/mixed', email.content_type) - assert_equal('iso-8559-1', email.charset) - assert_equal('2.0', email.mime_version) - assert_equal(['reply-to@test.lindsaar.net'], email.reply_to) - assert_equal(@time, email.date) + assert_equal(['bcc@test.lindsaar.net'], email.bcc) + assert_equal(['cc@test.lindsaar.net'], email.cc) + assert_equal('multipart/mixed; charset=iso-8559-1', email.content_type) + assert_equal('iso-8559-1', email.charset) + assert_equal('2.0', email.mime_version) + assert_equal(['reply-to@test.lindsaar.net'], email.reply_to) + assert_equal(@time, email.date) end test "mail() renders the template using the method being processed" do -- cgit v1.2.3 From 4e0d1cfad74454e65f6be5c265e0e4b4e099cec3 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Sun, 28 Mar 2010 17:03:33 +1100 Subject: Fixing up attachment encoding specs to work with latest mail - and be correct --- actionmailer/test/base_test.rb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'actionmailer/test') diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index aa28c5aa8b..baeee542be 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -39,8 +39,15 @@ class BaseTest < ActiveSupport::TestCase end def attachment_with_hash - attachments['invoice.jpg'] = { :data => "you smiling", :mime_type => "image/x-jpg", - :transfer_encoding => "base64" } + attachments['invoice.jpg'] = { :data => "\312\213\254\232)b", + :mime_type => "image/x-jpg", + :transfer_encoding => "base64" } + mail + end + + def attachment_with_hash_default_encoding + attachments['invoice.jpg'] = { :data => "\312\213\254\232)b", + :mime_type => "image/x-jpg" } mail end @@ -206,6 +213,15 @@ class BaseTest < ActiveSupport::TestCase assert_equal expected, email.attachments['invoice.jpg'].decoded end + test "attachment with hash using default mail encoding" do + email = BaseMailer.attachment_with_hash_default_encoding + assert_equal(1, email.attachments.length) + assert_equal('invoice.jpg', email.attachments[0].filename) + expected = "\312\213\254\232)b" + expected.force_encoding(Encoding::BINARY) if '1.9'.respond_to?(:force_encoding) + assert_equal expected, email.attachments['invoice.jpg'].decoded + end + test "sets mime type to multipart/mixed when attachment is included" do email = BaseMailer.attachment_with_content assert_equal(1, email.attachments.length) -- cgit v1.2.3