1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fixed bug on HTML only emails getting set to text/plain

This commit is contained in:
Mikel Lindsaar 2010-01-28 00:24:30 +11:00
parent f3caa63bcb
commit b6b3db6734
4 changed files with 21 additions and 1 deletions

View file

@ -531,7 +531,7 @@ module ActionMailer #:nodoc:
when m.multipart?
["multipart", "alternative", params]
else
class_default
m.content_type || class_default
end
end

View file

@ -17,6 +17,14 @@ class BaseTest < ActiveSupport::TestCase
def simple(hash = {})
mail(hash)
end
def html_only(hash = {})
mail(hash)
end
def plain_text_only(hash = {})
mail(hash)
end
def simple_with_headers(hash = {})
headers hash
@ -434,6 +442,16 @@ class BaseTest < ActiveSupport::TestCase
mail = BaseMailer.explicit_multipart
assert_not_nil(mail.content_type_parameters[:boundary])
end
test "should set a content type if only has an html part" do
mail = BaseMailer.html_only
assert_equal('text/html', mail.mime_type)
end
test "should set a content type if only has an plain text part" do
mail = BaseMailer.plain_text_only
assert_equal('text/plain', mail.mime_type)
end
protected

View file

@ -0,0 +1 @@
<h1>Testing</h1>

View file

@ -0,0 +1 @@
Testing