Skip to content
This repository
Browse code

Make mime version default to 1.0. closes #2323

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5081 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 45b5555f4cefaa61456e618e732c9ee5bb5b4e83 1 parent 4d9ca4d
Jamis Buck authored September 09, 2006
2  actionmailer/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Make mime version default to 1.0. closes #2323 [ror@andreas-s.net]
  4
+
3 5
 * Make sure quoted-printable text is decoded correctly when only portions of the text are encoded. closes #3154. [jon@siliconcircus.com]
4 6
 
5 7
 * Make sure DOS newlines in quoted-printable text are normalized to unix newlines before unquoting. closes #4166 and #4452. [Jamis Buck]
7  actionmailer/lib/action_mailer/base.rb
@@ -208,9 +208,8 @@ module ActionMailer #:nodoc:
208 208
   #   pick a different charset from inside a method with <tt>@charset</tt>.
209 209
   # * <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to "text/plain". You
210 210
   #   can also pick a different content type from inside a method with <tt>@content_type</tt>. 
211  
-  # * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to nil. You
212  
-  #   can also pick a different value from inside a method with <tt>@mime_version</tt>. When multipart messages are in
213  
-  #   use, <tt>@mime_version</tt> will be set to "1.0" if it is not set inside a method.
  211
+  # * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to "1.0". You
  212
+  #   can also pick a different value from inside a method with <tt>@mime_version</tt>.
214 213
   # * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
215 214
   #   which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
216 215
   #   ["text/html", "text/enriched", "text/plain"]. Items that appear first in the array have higher priority in the mail client
@@ -257,7 +256,7 @@ class Base
257 256
     @@default_content_type = "text/plain"
258 257
     cattr_accessor :default_content_type
259 258
     
260  
-    @@default_mime_version = nil
  259
+    @@default_mime_version = "1.0"
261 260
     cattr_accessor :default_mime_version
262 261
 
263 262
     @@default_implicit_parts_order = [ "text/html", "text/enriched", "text/plain" ]
20  actionmailer/test/abstract_unit.rb
@@ -8,3 +8,23 @@
8 8
 
9 9
 $:.unshift "#{File.dirname(__FILE__)}/fixtures/helpers"
10 10
 ActionMailer::Base.template_root = "#{File.dirname(__FILE__)}/fixtures"
  11
+
  12
+class MockSMTP
  13
+  def self.deliveries
  14
+    @@deliveries
  15
+  end
  16
+
  17
+  def initialize
  18
+    @@deliveries = []
  19
+  end
  20
+
  21
+  def sendmail(mail, from, to)
  22
+    @@deliveries << [mail, from, to]
  23
+  end
  24
+end
  25
+
  26
+class Net::SMTP
  27
+  def self.start(*args)
  28
+    yield MockSMTP.new
  29
+  end
  30
+end
22  actionmailer/test/mail_service_test.rb
... ...
@@ -1,25 +1,5 @@
1 1
 require "#{File.dirname(__FILE__)}/abstract_unit"
2 2
 
3  
-class MockSMTP
4  
-  def self.deliveries
5  
-    @@deliveries
6  
-  end
7  
-
8  
-  def initialize
9  
-    @@deliveries = []
10  
-  end
11  
-
12  
-  def sendmail(mail, from, to)
13  
-    @@deliveries << [mail, from, to]
14  
-  end
15  
-end
16  
-
17  
-class Net::SMTP
18  
-  def self.start(*args)
19  
-    yield MockSMTP.new
20  
-  end
21  
-end
22  
-
23 3
 class FunkyPathMailer < ActionMailer::Base
24 4
   self.template_root = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
25 5
 
@@ -274,6 +254,7 @@ def encode( text, charset="utf-8" )
274 254
 
275 255
   def new_mail( charset="utf-8" )
276 256
     mail = TMail::Mail.new
  257
+    mail.mime_version = "1.0"
277 258
     if charset
278 259
       mail.set_content_type "text", "plain", { "charset" => charset }
279 260
     end
@@ -315,7 +296,6 @@ def test_signed_up
315 296
     expected.body    = "Hello there, \n\nMr. #{@recipient}"
316 297
     expected.from    = "system@loudthinking.com"
317 298
     expected.date    = Time.local(2004, 12, 12)
318  
-    expected.mime_version = nil
319 299
 
320 300
     created = nil
321 301
     assert_nothing_raised { created = TestMailer.create_signed_up(@recipient) }
24  actionmailer/test/url_test.rb
... ...
@@ -1,25 +1,5 @@
1 1
 require "#{File.dirname(__FILE__)}/abstract_unit"
2 2
 
3  
-class MockSMTP
4  
-  def self.deliveries
5  
-    @@deliveries
6  
-  end
7  
-
8  
-  def initialize
9  
-    @@deliveries = []
10  
-  end
11  
-
12  
-  def sendmail(mail, from, to)
13  
-    @@deliveries << [mail, from, to]
14  
-  end
15  
-end
16  
-
17  
-class Net::SMTP
18  
-  def self.start(*args)
19  
-    yield MockSMTP.new
20  
-  end
21  
-end
22  
-
23 3
 class TestMailer < ActionMailer::Base
24 4
   def signed_up_with_url(recipient)
25 5
     @recipients   = recipient
@@ -40,7 +20,7 @@ def receive(mail)
40 20
   end
41 21
 end
42 22
 
43  
-class ActionMailerTest < Test::Unit::TestCase
  23
+class ActionMailerUrlTest < Test::Unit::TestCase
44 24
   include ActionMailer::Quoting
45 25
 
46 26
   def encode( text, charset="utf-8" )
@@ -49,6 +29,7 @@ def encode( text, charset="utf-8" )
49 29
 
50 30
   def new_mail( charset="utf-8" )
51 31
     mail = TMail::Mail.new
  32
+    mail.mime_version = "1.0"
52 33
     if charset
53 34
       mail.set_content_type "text", "plain", { "charset" => charset }
54 35
     end
@@ -74,7 +55,6 @@ def test_signed_up_with_url
74 55
     expected.body    = "Hello there, \n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting"
75 56
     expected.from    = "system@loudthinking.com"
76 57
     expected.date    = Time.local(2004, 12, 12)
77  
-    expected.mime_version = nil
78 58
 
79 59
     created = nil
80 60
     assert_nothing_raised { created = TestMailer.create_signed_up_with_url(@recipient) }

0 notes on commit 45b5555

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