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:
parent
f3caa63bcb
commit
b6b3db6734
4 changed files with 21 additions and 1 deletions
|
@ -531,7 +531,7 @@ module ActionMailer #:nodoc:
|
|||
when m.multipart?
|
||||
["multipart", "alternative", params]
|
||||
else
|
||||
class_default
|
||||
m.content_type || class_default
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
1
actionmailer/test/fixtures/base_mailer/html_only.html.erb
vendored
Normal file
1
actionmailer/test/fixtures/base_mailer/html_only.html.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<h1>Testing</h1>
|
1
actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb
vendored
Normal file
1
actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
Testing
|
Loading…
Reference in a new issue