From b6b3db6734af8d5b42c7bdcea7c73923a5b88463 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Thu, 28 Jan 2010 00:24:30 +1100 Subject: Fixed bug on HTML only emails getting set to text/plain --- actionmailer/test/base_test.rb | 18 ++++++++++++++++++ .../test/fixtures/base_mailer/html_only.html.erb | 1 + .../test/fixtures/base_mailer/plain_text_only.text.erb | 1 + 3 files changed, 20 insertions(+) create mode 100644 actionmailer/test/fixtures/base_mailer/html_only.html.erb create mode 100644 actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb (limited to 'actionmailer/test') diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 4a65363e3e..b7af86b622 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -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 diff --git a/actionmailer/test/fixtures/base_mailer/html_only.html.erb b/actionmailer/test/fixtures/base_mailer/html_only.html.erb new file mode 100644 index 0000000000..9c99a008e7 --- /dev/null +++ b/actionmailer/test/fixtures/base_mailer/html_only.html.erb @@ -0,0 +1 @@ +

Testing

\ No newline at end of file diff --git a/actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb b/actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb new file mode 100644 index 0000000000..0a90125685 --- /dev/null +++ b/actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb @@ -0,0 +1 @@ +Testing \ No newline at end of file -- cgit v1.2.3