From 906e308220785b0c57c78462b05eb1552387a9b8 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Mon, 23 Nov 2009 20:58:22 +1100 Subject: Fixed up incompatible encoding problem for Ruby 1.9 in test suite --- actionmailer/test/mail_service_test.rb | 12 +++++++++--- actionmailer/test/quoting_test.rb | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'actionmailer') diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 3099dddf87..c49657acd7 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -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 5319d2c6e8..a5deecf263 100644 --- a/actionmailer/test/quoting_test.rb +++ b/actionmailer/test/quoting_test.rb @@ -58,6 +58,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 -- cgit v1.2.3