Skip to content

Commit

Permalink
Add a new test case to demonstrate that subject headers are being pro…
Browse files Browse the repository at this point in the history
…perly encoded for multipart messages

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2893 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jamis committed Nov 6, 2005
1 parent 37e2085 commit afe7556
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions actionmailer/test/mail_service_test.rb
Expand Up @@ -111,6 +111,21 @@ def multipart_with_mime_version(recipient)
end
end

def multipart_with_utf8_subject(recipient)
recipients recipient
subject "Foo áëô îü"
from "test@example.com"
charset "utf-8"

part "text/plain" do |p|
p.body = "blah"
end

part "text/html" do |p|
p.body = "<b>blah</b>"
end
end

def explicitly_multipart_example(recipient, ct=nil)
recipients recipient
subject "multipart example"
Expand Down Expand Up @@ -580,6 +595,11 @@ def test_multipart_with_mime_version
mail = TestMailer.create_multipart_with_mime_version(@recipient)
assert_equal "1.1", mail.mime_version
end

def test_multipart_with_utf8_subject
mail = TestMailer.create_multipart_with_utf8_subject(@recipient)
assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
end

def test_explicitly_multipart_messages
mail = TestMailer.create_explicitly_multipart_example(@recipient)
Expand Down

0 comments on commit afe7556

Please sign in to comment.