Permalink
Browse files

Fixed up incompatible encoding problem for Ruby 1.9 in test suite

  • Loading branch information...
1 parent cc391c3 commit 906e308220785b0c57c78462b05eb1552387a9b8 @mikel mikel committed Nov 23, 2009
Showing with 13 additions and 3 deletions.
  1. +9 −3 actionmailer/test/mail_service_test.rb
  2. +4 −0 actionmailer/test/quoting_test.rb
@@ -1020,9 +1020,15 @@ def test_decode_encoded_attachment_filename
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
@@ -58,6 +58,10 @@ def test_quote_multibyte_chars
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

0 comments on commit 906e308

Please sign in to comment.