Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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 jamis authored
View
2  actionmailer/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Make mime version default to 1.0. closes #2323 [ror@andreas-s.net]
+
* Make sure quoted-printable text is decoded correctly when only portions of the text are encoded. closes #3154. [jon@siliconcircus.com]
* Make sure DOS newlines in quoted-printable text are normalized to unix newlines before unquoting. closes #4166 and #4452. [Jamis Buck]
View
7 actionmailer/lib/action_mailer/base.rb
@@ -208,9 +208,8 @@ module ActionMailer #:nodoc:
# pick a different charset from inside a method with <tt>@charset</tt>.
# * <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to "text/plain". You
# can also pick a different content type from inside a method with <tt>@content_type</tt>.
- # * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to nil. You
- # can also pick a different value from inside a method with <tt>@mime_version</tt>. When multipart messages are in
- # use, <tt>@mime_version</tt> will be set to "1.0" if it is not set inside a method.
+ # * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to "1.0". You
+ # can also pick a different value from inside a method with <tt>@mime_version</tt>.
# * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
# which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
# ["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
@@default_content_type = "text/plain"
cattr_accessor :default_content_type
- @@default_mime_version = nil
+ @@default_mime_version = "1.0"
cattr_accessor :default_mime_version
@@default_implicit_parts_order = [ "text/html", "text/enriched", "text/plain" ]
View
20 actionmailer/test/abstract_unit.rb
@@ -8,3 +8,23 @@
$:.unshift "#{File.dirname(__FILE__)}/fixtures/helpers"
ActionMailer::Base.template_root = "#{File.dirname(__FILE__)}/fixtures"
+
+class MockSMTP
+ def self.deliveries
+ @@deliveries
+ end
+
+ def initialize
+ @@deliveries = []
+ end
+
+ def sendmail(mail, from, to)
+ @@deliveries << [mail, from, to]
+ end
+end
+
+class Net::SMTP
+ def self.start(*args)
+ yield MockSMTP.new
+ end
+end
View
22 actionmailer/test/mail_service_test.rb
@@ -1,25 +1,5 @@
require "#{File.dirname(__FILE__)}/abstract_unit"
-class MockSMTP
- def self.deliveries
- @@deliveries
- end
-
- def initialize
- @@deliveries = []
- end
-
- def sendmail(mail, from, to)
- @@deliveries << [mail, from, to]
- end
-end
-
-class Net::SMTP
- def self.start(*args)
- yield MockSMTP.new
- end
-end
-
class FunkyPathMailer < ActionMailer::Base
self.template_root = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
@@ -274,6 +254,7 @@ def encode( text, charset="utf-8" )
def new_mail( charset="utf-8" )
mail = TMail::Mail.new
+ mail.mime_version = "1.0"
if charset
mail.set_content_type "text", "plain", { "charset" => charset }
end
@@ -315,7 +296,6 @@ def test_signed_up
expected.body = "Hello there, \n\nMr. #{@recipient}"
expected.from = "system@loudthinking.com"
expected.date = Time.local(2004, 12, 12)
- expected.mime_version = nil
created = nil
assert_nothing_raised { created = TestMailer.create_signed_up(@recipient) }
View
24 actionmailer/test/url_test.rb
@@ -1,25 +1,5 @@
require "#{File.dirname(__FILE__)}/abstract_unit"
-class MockSMTP
- def self.deliveries
- @@deliveries
- end
-
- def initialize
- @@deliveries = []
- end
-
- def sendmail(mail, from, to)
- @@deliveries << [mail, from, to]
- end
-end
-
-class Net::SMTP
- def self.start(*args)
- yield MockSMTP.new
- end
-end
-
class TestMailer < ActionMailer::Base
def signed_up_with_url(recipient)
@recipients = recipient
@@ -40,7 +20,7 @@ def receive(mail)
end
end
-class ActionMailerTest < Test::Unit::TestCase
+class ActionMailerUrlTest < Test::Unit::TestCase
include ActionMailer::Quoting
def encode( text, charset="utf-8" )
@@ -49,6 +29,7 @@ def encode( text, charset="utf-8" )
def new_mail( charset="utf-8" )
mail = TMail::Mail.new
+ mail.mime_version = "1.0"
if charset
mail.set_content_type "text", "plain", { "charset" => charset }
end
@@ -74,7 +55,6 @@ def test_signed_up_with_url
expected.body = "Hello there, \n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting"
expected.from = "system@loudthinking.com"
expected.date = Time.local(2004, 12, 12)
- expected.mime_version = nil
created = nil
assert_nothing_raised { created = TestMailer.create_signed_up_with_url(@recipient) }

0 comments on commit 45b5555

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