aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-09-01 14:45:10 +0000
committerJamis Buck <jamis@37signals.com>2005-09-01 14:45:10 +0000
commita32251487174dffe420980fbc9d43bcf4472d2af (patch)
tree542a8a5191200b31291f2caea8d7c98728750d1e /actionmailer/test
parentca410998abb8ed14bdc5edf0734eb8f83bf12317 (diff)
downloadrails-a32251487174dffe420980fbc9d43bcf4472d2af.tar.gz
rails-a32251487174dffe420980fbc9d43bcf4472d2af.tar.bz2
rails-a32251487174dffe420980fbc9d43bcf4472d2af.zip
Preserve underscores when unquoting message bodies #1930
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2089 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/test')
-rwxr-xr-xactionmailer/test/mail_service_test.rb10
-rw-r--r--actionmailer/test/tmail_test.rb17
2 files changed, 27 insertions, 0 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index 50eb1984b5..c181b14f9a 100755
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -145,6 +145,11 @@ class TestMailer < ActionMailer::Base
content_type "text/html"
end
+ def html_mail_with_underscores(recipient)
+ subject "html mail with underscores"
+ body %{<a href="http://google.com" target="_blank">_Google</a>}
+ end
+
def custom_template(recipient)
recipients recipient
subject "[Signed up] Welcome #{recipient}"
@@ -631,6 +636,11 @@ EOF
assert_equal "text/html", mail.content_type
end
+ def test_html_mail_with_underscores
+ mail = TestMailer.create_html_mail_with_underscores(@recipient)
+ assert_equal %{<a href="http://google.com" target="_blank">_Google</a>}, mail.body
+ end
+
def test_various_newlines
mail = TestMailer.create_various_newlines(@recipient)
assert_equal("line #1\nline #2\nline #3\nline #4\n\n" +
diff --git a/actionmailer/test/tmail_test.rb b/actionmailer/test/tmail_test.rb
new file mode 100644
index 0000000000..3930c7d39a
--- /dev/null
+++ b/actionmailer/test/tmail_test.rb
@@ -0,0 +1,17 @@
+$:.unshift(File.dirname(__FILE__) + "/../lib/")
+$:.unshift File.dirname(__FILE__) + "/fixtures/helpers"
+
+require 'test/unit'
+require 'action_mailer'
+
+class TMailMailTest < Test::Unit::TestCase
+ def test_body
+ m = TMail::Mail.new
+ expected = 'something_with_underscores'
+ m.encoding = 'quoted-printable'
+ quoted_body = [expected].pack('*M')
+ m.body = quoted_body
+ assert_equal "something_with_underscores=\n", m.quoted_body
+ assert_equal expected, m.body
+ end
+end