Skip to content
This repository
Browse code

131 tests, 266 assertions, 9 failures, 6 errors

  • Loading branch information...
commit 0e38f5bdccf7465ea05090db2a4a2659aa3012ea 1 parent 6456a08
Mikel Lindsaar authored November 21, 2009
23  actionmailer/CHANGELOG
... ...
@@ -1,3 +1,26 @@
  1
+*Mail Integration
  2
+
  3
+* Mail does not have "quoted_body", "quoted_subject" etc.  All of these are accessed via body.encoded, subject.encoded etc
  4
+
  5
+* 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
  6
+
  7
+* Mail::Message#set_content_type does not exist, it is simply Mail::Message#content_type
  8
+
  9
+* Every mail message gets a unique message_id unless you specify one, had to change all the tests that check for
  10
+  equality with expected.encoded == actual.encoded to first replace their message_ids with control values
  11
+
  12
+* Mail now has a proper concept of parts, remove the ActionMailer::Part and ActionMailer::PartContainer classes
  13
+
  14
+* Calling #encoded on any object returns it as a string ready to go into the output stream of an email, this
  15
+  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
  16
+  header field.  Also, the "encoded" value includes the field name if it is a header field.
  17
+
  18
+* Attachments are only the actual attachment, with filename etc.  A part contains an attachment.  The part
  19
+  has the content_type etc.  So attachments.last.content_type is invalid.  But parts.last.content_type
  20
+  
  21
+* There is no idea of a "sub_head" in Mail.  A part is just a Message with some extra functionality, so it 
  22
+  just has a "header" like a normal mail message
  23
+
1 24
 *2.3.2 [Final] (March 15, 2009)*
2 25
 
3 26
 * Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
12  actionmailer/test/mail_service_test.rb
@@ -708,7 +708,7 @@ def test_unquote_7bit_subject
708 708
 EOF
709 709
     mail = Mail.new(msg)
710 710
     assert_equal "this == working?", mail.subject.decoded
711  
-    assert_equal "this == working?", mail.quoted_subject
  711
+    assert_equal "Subject: this == working?\r\n", mail.subject.encoded
712 712
   end
713 713
 
714 714
   def test_unquote_7bit_body
@@ -722,7 +722,7 @@ def test_unquote_7bit_body
722 722
 EOF
723 723
     mail = Mail.new(msg)
724 724
     assert_equal "The=3Dbody", mail.body.decoded.strip
725  
-    assert_equal "The=3Dbody", mail.quoted_body.strip
  725
+    assert_equal "The=3Dbody", mail.body.encoded.strip
726 726
   end
727 727
 
728 728
   def test_unquote_quoted_printable_body
@@ -736,7 +736,7 @@ def test_unquote_quoted_printable_body
736 736
 EOF
737 737
     mail = Mail.new(msg)
738 738
     assert_equal "The=body", mail.body.decoded.strip
739  
-    assert_equal "The=3Dbody", mail.quoted_body.strip
  739
+    assert_equal "The=3Dbody", mail.body.encoded.strip
740 740
   end
741 741
 
742 742
   def test_unquote_base64_body
@@ -750,7 +750,7 @@ def test_unquote_base64_body
750 750
 EOF
751 751
     mail = Mail.new(msg)
752 752
     assert_equal "The body", mail.body.decoded.strip
753  
-    assert_equal "VGhlIGJvZHk=", mail.quoted_body.strip
  753
+    assert_equal "VGhlIGJvZHk=", mail.body.encoded.strip
754 754
   end
755 755
 
756 756
   def test_extended_headers
@@ -823,7 +823,7 @@ def test_multiple_utf8_recipients
823 823
   def test_receive_decodes_base64_encoded_mail
824 824
     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email")
825 825
     TestMailer.receive(fixture)
826  
-    assert_match(/Jamis/, TestMailer.received_body)
  826
+    assert_match(/Jamis/, TestMailer.received_body.decoded)
827 827
   end
828 828
 
829 829
   def test_receive_attachments
@@ -831,7 +831,7 @@ def test_receive_attachments
831 831
     mail = Mail.new(fixture)
832 832
     attachment = mail.attachments.last
833 833
     assert_equal "smime.p7s", attachment.original_filename
834  
-    assert_equal "application/pkcs7-signature", attachment.content_type
  834
+    assert_equal "application/pkcs7-signature", mail.parts.last.content_type.string
835 835
   end
836 836
 
837 837
   def test_decode_attachment_without_charset
14  actionmailer/test/quoting_test.rb
@@ -6,37 +6,37 @@ class QuotingTest < Test::Unit::TestCase
6 6
   # Move some tests from TMAIL here
7 7
   def test_unquote_quoted_printable
8 8
     a ="=?ISO-8859-1?Q?[166417]_Bekr=E6ftelse_fra_Rejsefeber?="
9  
-    b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
  9
+    b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
10 10
     assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
11 11
   end
12 12
 
13 13
   def test_unquote_base64
14 14
     a ="=?ISO-8859-1?B?WzE2NjQxN10gQmVrcuZmdGVsc2UgZnJhIFJlanNlZmViZXI=?="
15  
-    b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
  15
+    b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
16 16
     assert_equal "[166417] Bekr\303\246ftelse fra Rejsefeber", b
17 17
   end
18 18
 
19 19
   def test_unquote_without_charset
20 20
     a ="[166417]_Bekr=E6ftelse_fra_Rejsefeber"
21  
-    b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
  21
+    b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
22 22
     assert_equal "[166417]_Bekr=E6ftelse_fra_Rejsefeber", b
23 23
   end
24 24
 
25 25
   def test_unqoute_multiple
26 26
     a ="=?utf-8?q?Re=3A_=5B12=5D_=23137=3A_Inkonsistente_verwendung_von_=22Hin?==?utf-8?b?enVmw7xnZW4i?="
27  
-    b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
  27
+    b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
28 28
     assert_equal "Re: [12] #137: Inkonsistente verwendung von \"Hinzuf\303\274gen\"", b
29 29
   end
30 30
 
31 31
   def test_unqoute_in_the_middle
32 32
     a ="Re: Photos =?ISO-8859-1?Q?Brosch=FCre_Rand?="
33  
-    b = TMail::Unquoter.unquote_and_convert_to(a, 'utf-8')
  33
+    b = Mail::Encodings.unquote_and_convert_to(a, 'utf-8')
34 34
     assert_equal "Re: Photos Brosch\303\274re Rand", b
35 35
   end
36 36
 
37 37
   def test_unqoute_iso
38 38
     a ="=?ISO-8859-1?Q?Brosch=FCre_Rand?="
39  
-    b = TMail::Unquoter.unquote_and_convert_to(a, 'iso-8859-1')
  39
+    b = Mail::Encodings.unquote_and_convert_to(a, 'iso-8859-1')
40 40
     expected = "Brosch\374re Rand"
41 41
     expected.force_encoding 'iso-8859-1' if expected.respond_to?(:force_encoding)
42 42
     assert_equal expected, b
@@ -57,7 +57,7 @@ def test_quote_multibyte_chars
57 57
       quoted_printable(#{original.inspect}, "UTF-8")
58 58
     CODE
59 59
 
60  
-    unquoted = TMail::Unquoter.unquote_and_convert_to(result, nil)
  60
+    unquoted = Mail::Encodings.unquote_and_convert_to(result, nil)
61 61
     assert_equal unquoted, original
62 62
   end
63 63
 

0 notes on commit 0e38f5b

Please sign in to comment.
Something went wrong with that request. Please try again.