diff options
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/mail_helper_test.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/actionmailer/test/mail_helper_test.rb b/actionmailer/test/mail_helper_test.rb index 17e9c82045..d8a73e6c46 100644 --- a/actionmailer/test/mail_helper_test.rb +++ b/actionmailer/test/mail_helper_test.rb @@ -22,6 +22,14 @@ class HelperMailer < ActionMailer::Base end end + def use_format_paragraph_with_long_first_word + @text = "Antidisestablishmentarianism is very long." + + mail_with_defaults do |format| + format.html { render(:inline => "<%= format_paragraph @text, 10, 1 %>") } + end + end + def use_mailer mail_with_defaults do |format| format.html { render(:inline => "<%= mailer.message.subject %>") } @@ -34,6 +42,23 @@ class HelperMailer < ActionMailer::Base end end + def use_block_format + @text = <<-TEXT +This is the +first paragraph. + +The second + paragraph. + +* item1 * item2 + * item3 + TEXT + + mail_with_defaults do |format| + format.html { render(:inline => "<%= block_format @text %>") } + end + end + protected def mail_with_defaults(&block) @@ -63,5 +88,24 @@ class MailerHelperTest < ActionMailer::TestCase mail = HelperMailer.use_format_paragraph assert_match " But soft! What\r\n light through\r\n yonder window\r\n breaks?", mail.body.encoded end + + def test_use_format_paragraph_with_long_first_word + mail = HelperMailer.use_format_paragraph_with_long_first_word + assert_equal " Antidisestablishmentarianism\r\n is very\r\n long.", mail.body.encoded + end + + def test_use_block_format + mail = HelperMailer.use_block_format + expected = <<-TEXT + This is the first paragraph. + + The second paragraph. + + * item1 + * item2 + * item3 + TEXT + assert_equal expected.gsub("\n", "\r\n"), mail.body.encoded + end end |