mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
131 tests, 266 assertions, 9 failures, 6 errors
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
*Mail Integration
|
||||
|
||||
* Mail does not have "quoted_body", "quoted_subject" etc. All of these are accessed via body.encoded, subject.encoded etc
|
||||
|
||||
* Every part of a Mail object returns an object, never a string. So Mail.body returns a Mail::Body class object, need to call #encoded or #decoded to get the string you want
|
||||
|
||||
* Mail::Message#set_content_type does not exist, it is simply Mail::Message#content_type
|
||||
|
||||
* Every mail message gets a unique message_id unless you specify one, had to change all the tests that check for
|
||||
equality with expected.encoded == actual.encoded to first replace their message_ids with control values
|
||||
|
||||
* Mail now has a proper concept of parts, remove the ActionMailer::Part and ActionMailer::PartContainer classes
|
||||
|
||||
* Calling #encoded on any object returns it as a string ready to go into the output stream of an email, this
|
||||
means it includes the \r\n at the end of the lines and the object is pre-wrapped with \r\n\t if it is a
|
||||
header field. Also, the "encoded" value includes the field name if it is a header field.
|
||||
|
||||
* Attachments are only the actual attachment, with filename etc. A part contains an attachment. The part
|
||||
has the content_type etc. So attachments.last.content_type is invalid. But parts.last.content_type
|
||||
|
||||
* There is no idea of a "sub_head" in Mail. A part is just a Message with some extra functionality, so it
|
||||
just has a "header" like a normal mail message
|
||||
|
||||
*2.3.2 [Final] (March 15, 2009)*
|
||||
|
||||
* Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
|
||||
|
||||
@@ -708,7 +708,7 @@ The body
|
||||
EOF
|
||||
mail = Mail.new(msg)
|
||||
assert_equal "this == working?", mail.subject.decoded
|
||||
assert_equal "this == working?", mail.quoted_subject
|
||||
assert_equal "Subject: this == working?\r\n", mail.subject.encoded
|
||||
end
|
||||
|
||||
def test_unquote_7bit_body
|
||||
@@ -722,7 +722,7 @@ The=3Dbody
|
||||
EOF
|
||||
mail = Mail.new(msg)
|
||||
assert_equal "The=3Dbody", mail.body.decoded.strip
|
||||
assert_equal "The=3Dbody", mail.quoted_body.strip
|
||||
assert_equal "The=3Dbody", mail.body.encoded.strip
|
||||
end
|
||||
|
||||
def test_unquote_quoted_printable_body
|
||||
@@ -736,7 +736,7 @@ The=3Dbody
|
||||
EOF
|
||||
mail = Mail.new(msg)
|
||||
assert_equal "The=body", mail.body.decoded.strip
|
||||
assert_equal "The=3Dbody", mail.quoted_body.strip
|
||||
assert_equal "The=3Dbody", mail.body.encoded.strip
|
||||
end
|
||||
|
||||
def test_unquote_base64_body
|
||||
@@ -750,7 +750,7 @@ VGhlIGJvZHk=
|
||||
EOF
|
||||
mail = Mail.new(msg)
|
||||
assert_equal "The body", mail.body.decoded.strip
|
||||
assert_equal "VGhlIGJvZHk=", mail.quoted_body.strip
|
||||
assert_equal "VGhlIGJvZHk=", mail.body.encoded.strip
|
||||
end
|
||||
|
||||
def test_extended_headers
|
||||
@@ -823,7 +823,7 @@ EOF
|
||||
def test_receive_decodes_base64_encoded_mail
|
||||
fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email")
|
||||
TestMailer.receive(fixture)
|
||||
assert_match(/Jamis/, TestMailer.received_body)
|
||||
assert_match(/Jamis/, TestMailer.received_body.decoded)
|
||||
end
|
||||
|
||||
def test_receive_attachments
|
||||
@@ -831,7 +831,7 @@ EOF
|
||||
mail = Mail.new(fixture)
|
||||
attachment = mail.attachments.last
|
||||
assert_equal "smime.p7s", attachment.original_filename
|
||||
assert_equal "application/pkcs7-signature", attachment.content_type
|
||||
assert_equal "application/pkcs7-signature", mail.parts.last.content_type.string
|
||||
end
|
||||
|
||||
def test_decode_attachment_without_charset
|
||||
|
||||
@@ -6,37 +6,37 @@ class QuotingTest < Test::Unit::TestCase
|
||||
# Move some tests from TMAIL here
|
||||
def test_unquote_quoted_printable
|
||||
a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
|
||||
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
||||
b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
|
||||
assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
|
||||
end
|
||||
|
||||
def test_unquote_base64
|
||||
a ="=?ISO-8859-1?B?WzE2NjQxN10gQmVrcuZmdGVsc2UgZnJhIFJlanNlZmViZXI=?="
|
||||
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
||||
b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
|
||||
assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
|
||||
end
|
||||
|
||||
def test_unquote_without_charset
|
||||
a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
|
||||
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
||||
b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
|
||||
assert_equal "[166417]_Bekr=E6ftelse_fra_Rejsefeber", b
|
||||
end
|
||||
|
||||
def test_unqoute_multiple
|
||||
a ="=?utf-8?q?Re=3A_=5B12=5D_=23137=3A_Inkonsistente_verwendung_von_=22Hin?==?utf-8?b?enVmw7xnZW4i?="
|
||||
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
||||
b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
|
||||
assert_equal "Re: [12] #137: Inkonsistente verwendung von \"Hinzuf\303\274gen\"", b
|
||||
end
|
||||
|
||||
def test_unqoute_in_the_middle
|
||||
a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
|
||||
b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
|
||||
b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
|
||||
assert_equal "Re: Photos Brosch\303\274re Rand", b
|
||||
end
|
||||
|
||||
def test_unqoute_iso
|
||||
a ="=?ISO-8859-1?Q?Brosch=FCre_Rand?="
|
||||
b = TMail::Unquoter.unquote_and_convert_to(a, 'iso-8859-1')
|
||||
b = Mail::Encodings.unquote_and_convert_to(a, 'iso-8859-1')
|
||||
expected = "Brosch\374re Rand"
|
||||
expected.force_encoding 'iso-8859-1' if expected.respond_to?(:force_encoding)
|
||||
assert_equal expected, b
|
||||
@@ -57,7 +57,7 @@ class QuotingTest < Test::Unit::TestCase
|
||||
quoted_printable(#{original.inspect}, "UTF-8")
|
||||
CODE
|
||||
|
||||
unquoted = TMail::Unquoter.unquote_and_convert_to(result, nil)
|
||||
unquoted = Mail::Encodings.unquote_and_convert_to(result, nil)
|
||||
assert_equal unquoted, original
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user