diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-23 15:29:35 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-23 15:29:35 -0800 |
commit | 671538cd6ea0bd4c463e7bf7d238a55924a8af53 (patch) | |
tree | 661710f2df243f02452846c3e85f2980acbf813a /actionmailer/test | |
parent | ca5de16ddc50b4f8d8a88e91571f5c5a2c8c751c (diff) | |
parent | 3a72923e27195983d37bdb39ef26b29cf03d3483 (diff) | |
download | rails-671538cd6ea0bd4c463e7bf7d238a55924a8af53.tar.gz rails-671538cd6ea0bd4c463e7bf7d238a55924a8af53.tar.bz2 rails-671538cd6ea0bd4c463e7bf7d238a55924a8af53.zip |
Merge commit 'mikel/master' into mail
Conflicts:
actionmailer/lib/action_mailer.rb
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/mail_service_test.rb | 22 | ||||
-rw-r--r-- | actionmailer/test/quoting_test.rb | 4 |
2 files changed, 18 insertions, 8 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 9be9a93fef..7a47a654cd 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -9,7 +9,7 @@ class FunkyPathMailer < ActionMailer::Base subject "This path has dots" from "Chad Fowler <chad@chadfowler.com>" attachment :content_type => "text/plain", - :body => "dots dots dots..." + :data => "dots dots dots..." end end @@ -144,7 +144,7 @@ class TestMailer < ActionMailer::Base end attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "foo.jpg"), - :body => "123456789" + :data => "123456789" render :text => "plain text default" end @@ -232,7 +232,7 @@ class TestMailer < ActionMailer::Base p.part :content_type => "text/html", :body => "<b>test</b> HTML<br/>\nline #2" end - attachment :content_type => "application/octet-stream", :filename => "test.txt", :body => "test abcdefghijklmnopqstuvwxyz" + attachment :content_type => "application/octet-stream", :filename => "test.txt", :data => "test abcdefghijklmnopqstuvwxyz" end def nested_multipart_with_body(recipient) @@ -252,7 +252,7 @@ class TestMailer < ActionMailer::Base from "test@example.com" content_type "multipart/related" part :content_type => "text/html", :body => 'yo' - attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "test.jpg"), :body => "i am not a real picture", :headers => { 'Content-ID' => '<test@test.com>' } + attachment :content_type => "image/jpeg", :filename => File.join(File.dirname(__FILE__), "fixtures", "attachments", "test.jpg"), :data => "i am not a real picture", :headers => { 'Content-ID' => '<test@test.com>' } end def unnamed_attachment(recipient) @@ -261,7 +261,7 @@ class TestMailer < ActionMailer::Base from "test@example.com" content_type "multipart/mixed" part :content_type => "text/plain", :body => "hullo" - attachment :content_type => "application/octet-stream", :body => "test abcdefghijklmnopqstuvwxyz" + attachment :content_type => "application/octet-stream", :data => "test abcdefghijklmnopqstuvwxyz" end def headers_with_nonalpha_chars(recipient) @@ -1020,9 +1020,15 @@ EOF attachment = mail.attachments.last expected = "01 Quien Te Dij\212at. Pitbull.mp3" - expected.force_encoding(Encoding::ASCII_8BIT) if expected.respond_to?(:force_encoding) - - assert_equal expected, attachment.original_filename + + if expected.respond_to?(:force_encoding) + result = attachment.original_filename.dup + expected.force_encoding(Encoding::ASCII_8BIT) + result.force_encoding(Encoding::ASCII_8BIT) + assert_equal expected, result + else + assert_equal expected, attachment.original_filename + end end def test_decode_message_with_unknown_charset diff --git a/actionmailer/test/quoting_test.rb b/actionmailer/test/quoting_test.rb index 4e86d55285..32f34f6028 100644 --- a/actionmailer/test/quoting_test.rb +++ b/actionmailer/test/quoting_test.rb @@ -57,6 +57,10 @@ class QuotingTest < Test::Unit::TestCase CODE unquoted = Mail::Encodings.unquote_and_convert_to(result, nil) + + unquoted.force_encoding(Encoding::ASCII_8BIT) if unquoted.respond_to?(:force_encoding) + original.force_encoding(Encoding::ASCII_8BIT) if original.respond_to?(:force_encoding) + assert_equal unquoted, original end |