From dd8e5f04e3ab406de56cce82427a181a11cedec9 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 2 Dec 2020 13:02:25 +0000 Subject: [PATCH] Add a test for i18n interpolation into plain and html parts I spent some time working on an alternative translation strategy, without realising some of the plain text implications. --- test/mailers/user_mailer_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/mailers/user_mailer_test.rb b/test/mailers/user_mailer_test.rb index 2a4b5a417..537bb9d0d 100644 --- a/test/mailers/user_mailer_test.rb +++ b/test/mailers/user_mailer_test.rb @@ -17,4 +17,13 @@ class UserMailerTest < ActionMailer::TestCase assert_match(/one two three/, email.html_part.body.to_s) end + + def test_html_encoding + user = create(:user, :display_name => "Jack & Jill
") + message = create(:message, :sender => user) + email = UserMailer.message_notification(message) + + assert_match("Jack & Jill
", email.text_part.body.to_s) + assert_match("Jack & Jill <br>", email.html_part.body.to_s) + end end -- 2.45.1