diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-01-22 10:11:13 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-01-22 10:11:13 +0000 |
commit | 4807beaebf192dca34ea5661df0de0acb33e2e11 (patch) | |
tree | 36478100ecd35fbdbb34f58c225cb74b01ed0b34 /test/unit | |
parent | a347d212b5e89c91e939015696ce099cb87527b7 (diff) | |
download | redmine-4807beaebf192dca34ea5661df0de0acb33e2e11.tar.gz redmine-4807beaebf192dca34ea5661df0de0acb33e2e11.zip |
Explicitly specify text formatting in the tests (#35952).
Patch by Go MAEDA.
git-svn-id: http://svn.redmine.org/redmine/trunk@21386 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/lib/redmine/field_format/field_format_test.rb | 12 | ||||
-rw-r--r-- | test/unit/lib/redmine/wiki_formatting/macros_test.rb | 303 | ||||
-rw-r--r-- | test/unit/mailer_test.rb | 4 |
3 files changed, 191 insertions, 128 deletions
diff --git a/test/unit/lib/redmine/field_format/field_format_test.rb b/test/unit/lib/redmine/field_format/field_format_test.rb index 8d8874b36..5bcda2156 100644 --- a/test/unit/lib/redmine/field_format/field_format_test.rb +++ b/test/unit/lib/redmine/field_format/field_format_test.rb @@ -39,8 +39,10 @@ class Redmine::FieldFormatTest < ActionView::TestCase field = IssueCustomField.new(:field_format => 'string', :text_formatting => 'full') custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*") - assert_equal "*foo*", field.format.formatted_custom_value(self, custom_value, false) - assert_include "<strong>foo</strong>", field.format.formatted_custom_value(self, custom_value, true) + with_settings :text_formatting => 'textile' do + assert_equal '*foo*', field.format.formatted_custom_value(self, custom_value, false) + assert_include '<strong>foo</strong>', field.format.formatted_custom_value(self, custom_value, true) + end end def test_text_field_with_text_formatting_disabled_should_not_format_text @@ -55,8 +57,10 @@ class Redmine::FieldFormatTest < ActionView::TestCase field = IssueCustomField.new(:field_format => 'text', :text_formatting => 'full') custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*\nbar") - assert_equal "*foo*\nbar", field.format.formatted_custom_value(self, custom_value, false) - assert_include "<strong>foo</strong>", field.format.formatted_custom_value(self, custom_value, true) + with_settings :text_formatting => 'textile' do + assert_equal "*foo*\nbar", field.format.formatted_custom_value(self, custom_value, false) + assert_include '<strong>foo</strong>', field.format.formatted_custom_value(self, custom_value, true) + end end def test_should_validate_url_pattern_with_safe_scheme diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb index 39448df31..28be28d47 100644 --- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb @@ -50,10 +50,12 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest end end - assert_equal '<p>Foo: 0 () (Array)</p>', textilizable("{{foo}}") - assert_equal '<p>Foo: 0 () (Array)</p>', textilizable("{{foo()}}") - assert_equal '<p>Foo: 1 (arg1) (Array)</p>', textilizable("{{foo(arg1)}}") - assert_equal '<p>Foo: 2 (arg1,arg2) (Array)</p>', textilizable("{{foo(arg1, arg2)}}") + with_settings :text_formatting => 'textile' do + assert_equal '<p>Foo: 0 () (Array)</p>', textilizable('{{foo}}') + assert_equal '<p>Foo: 0 () (Array)</p>', textilizable('{{foo()}}') + assert_equal '<p>Foo: 1 (arg1) (Array)</p>', textilizable('{{foo(arg1)}}') + assert_equal '<p>Foo: 2 (arg1,arg2) (Array)</p>', textilizable('{{foo(arg1, arg2)}}') + end end def test_macro_registration_parse_args_set_to_false_should_disable_arguments_parsing @@ -63,9 +65,11 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest end end - assert_equal '<p>Bar: (args, more args) (String)</p>', textilizable("{{bar(args, more args)}}") - assert_equal '<p>Bar: () (String)</p>', textilizable("{{bar}}") - assert_equal '<p>Bar: () (String)</p>', textilizable("{{bar()}}") + with_settings :text_formatting => 'textile' do + assert_equal '<p>Bar: (args, more args) (String)</p>', textilizable('{{bar(args, more args)}}') + assert_equal '<p>Bar: () (String)</p>', textilizable('{{bar}}') + assert_equal '<p>Bar: () (String)</p>', textilizable('{{bar()}}') + end end def test_macro_registration_with_3_args_should_receive_text_argument @@ -75,16 +79,19 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest end end - assert_equal "<p>Baz: () (NilClass) ()</p>", textilizable("{{baz}}") - assert_equal "<p>Baz: () (NilClass) ()</p>", textilizable("{{baz()}}") - assert_equal "<p>Baz: () (String) (line1\nline2)</p>", textilizable("{{baz()\nline1\nline2\n}}") - assert_equal "<p>Baz: (arg1,arg2) (String) (line1\nline2)</p>", textilizable("{{baz(arg1, arg2)\nline1\nline2\n}}") + with_settings :text_formatting => 'textile' do + assert_equal '<p>Baz: () (NilClass) ()</p>', textilizable('{{baz}}') + assert_equal '<p>Baz: () (NilClass) ()</p>', textilizable('{{baz()}}') + assert_equal "<p>Baz: () (String) (line1\nline2)</p>", textilizable("{{baz()\nline1\nline2\n}}") + assert_equal "<p>Baz: (arg1,arg2) (String) (line1\nline2)</p>", textilizable("{{baz(arg1, arg2)\nline1\nline2\n}}") + end end def test_macro_name_with_upper_case - Redmine::WikiFormatting::Macros.macro(:UpperCase) {|obj, args| "Upper"} - - assert_equal "<p>Upper</p>", textilizable("{{UpperCase}}") + with_settings :text_formatting => 'textile' do + Redmine::WikiFormatting::Macros.macro(:UpperCase) {|obj, args| 'Upper'} + assert_equal '<p>Upper</p>', textilizable('{{UpperCase}}') + end end def test_multiple_macros_on_the_same_line @@ -92,27 +99,33 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest args.any? ? "args: #{args.join(',')}" : "no args" end - assert_equal '<p>no args no args</p>', textilizable("{{foo}} {{foo}}") - assert_equal '<p>args: a,b no args</p>', textilizable("{{foo(a,b)}} {{foo}}") - assert_equal '<p>args: a,b args: c,d</p>', textilizable("{{foo(a,b)}} {{foo(c,d)}}") - assert_equal '<p>no args args: c,d</p>', textilizable("{{foo}} {{foo(c,d)}}") + with_settings :text_formatting => 'textile' do + assert_equal '<p>no args no args</p>', textilizable('{{foo}} {{foo}}') + assert_equal '<p>args: a,b no args</p>', textilizable('{{foo(a,b)}} {{foo}}') + assert_equal '<p>args: a,b args: c,d</p>', textilizable('{{foo(a,b)}} {{foo(c,d)}}') + assert_equal '<p>no args args: c,d</p>', textilizable('{{foo}} {{foo(c,d)}}') + end end def test_macro_should_receive_the_object_as_argument_when_with_object_and_attribute issue = Issue.find(1) issue.description = "{{hello_world}}" - assert_equal( - '<p>Hello world! Object: Issue, Called with no argument and no block of text.</p>', - textilizable(issue, :description) - ) + with_settings :text_formatting => 'textile' do + assert_equal( + '<p>Hello world! Object: Issue, Called with no argument and no block of text.</p>', + textilizable(issue, :description) + ) + end end def test_macro_should_receive_the_object_as_argument_when_called_with_object_option - text = "{{hello_world}}" - assert_equal( - '<p>Hello world! Object: Issue, Called with no argument and no block of text.</p>', - textilizable(text, :object => Issue.find(1)) - ) + with_settings :text_formatting => 'textile' do + text = '{{hello_world}}' + assert_equal( + '<p>Hello world! Object: Issue, Called with no argument and no block of text.</p>', + textilizable(text, :object => Issue.find(1)) + ) + end end def test_extract_macro_options_should_with_args @@ -153,35 +166,47 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest end def test_exclamation_mark_should_not_run_macros - text = "!{{hello_world}}" - assert_equal '<p>{{hello_world}}</p>', textilizable(text) + with_settings :text_formatting => 'textile' do + text = '!{{hello_world}}' + assert_equal '<p>{{hello_world}}</p>', textilizable(text) + end end def test_exclamation_mark_should_escape_macros - text = "!{{hello_world(<tag>)}}" - assert_equal '<p>{{hello_world(<tag>)}}</p>', textilizable(text) + with_settings :text_formatting => 'textile' do + text = '!{{hello_world(<tag>)}}' + assert_equal '<p>{{hello_world(<tag>)}}</p>', textilizable(text) + end end def test_unknown_macros_should_not_be_replaced - text = "{{unknown}}" - assert_equal '<p>{{unknown}}</p>', textilizable(text) + with_settings :text_formatting => 'textile' do + text = '{{unknown}}' + assert_equal '<p>{{unknown}}</p>', textilizable(text) + end end def test_unknown_macros_should_parsed_as_text - text = "{{unknown(*test*)}}" - assert_equal '<p>{{unknown(<strong>test</strong>)}}</p>', textilizable(text) + with_settings :text_formatting => 'textile' do + text = '{{unknown(*test*)}}' + assert_equal '<p>{{unknown(<strong>test</strong>)}}</p>', textilizable(text) + end end def test_unknown_macros_should_be_escaped - text = "{{unknown(<tag>)}}" - assert_equal '<p>{{unknown(<tag>)}}</p>', textilizable(text) + with_settings :text_formatting => 'textile' do + text = '{{unknown(<tag>)}}' + assert_equal '<p>{{unknown(<tag>)}}</p>', textilizable(text) + end end def test_html_safe_macro_output_should_not_be_escaped - Redmine::WikiFormatting::Macros.macro :safe_macro do |obj, args| - "<tag>".html_safe + with_settings :text_formatting => 'textile' do + Redmine::WikiFormatting::Macros.macro :safe_macro do |obj, args| + '<tag>'.html_safe + end + assert_equal '<p><tag></p>', textilizable('{{safe_macro}}') end - assert_equal '<p><tag></p>', textilizable("{{safe_macro}}") end def test_macro_hello_world @@ -220,33 +245,39 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest def test_macro_collapse text = "{{collapse\n*Collapsed* block of text\n}}" with_locale 'en' do - result = textilizable(text) + with_settings :text_formatting => 'textile' do + result = textilizable(text) - assert_select_in result, 'div.collapsed-text' - assert_select_in result, 'strong', :text => 'Collapsed' - assert_select_in result, 'a.collapsible.icon-collapsed', :text => 'Show' - assert_select_in result, 'a.collapsible.icon-expanded', :text => 'Hide' + assert_select_in result, 'div.collapsed-text' + assert_select_in result, 'strong', :text => 'Collapsed' + assert_select_in result, 'a.collapsible.icon-collapsed', :text => 'Show' + assert_select_in result, 'a.collapsible.icon-expanded', :text => 'Hide' + end end end def test_macro_collapse_with_one_arg text = "{{collapse(Example)\n*Collapsed* block of text\n}}" - result = textilizable(text) + with_settings :text_formatting => 'textile' do + result = textilizable(text) - assert_select_in result, 'div.collapsed-text' - assert_select_in result, 'strong', :text => 'Collapsed' - assert_select_in result, 'a.collapsible.icon-collapsed', :text => 'Example' - assert_select_in result, 'a.collapsible.icon-expanded', :text => 'Example' + assert_select_in result, 'div.collapsed-text' + assert_select_in result, 'strong', :text => 'Collapsed' + assert_select_in result, 'a.collapsible.icon-collapsed', :text => 'Example' + assert_select_in result, 'a.collapsible.icon-expanded', :text => 'Example' + end end def test_macro_collapse_with_two_args text = "{{collapse(Show example, Hide example)\n*Collapsed* block of text\n}}" - result = textilizable(text) + with_settings :text_formatting => 'textile' do + result = textilizable(text) - assert_select_in result, 'div.collapsed-text' - assert_select_in result, 'strong', :text => 'Collapsed' - assert_select_in result, 'a.collapsible.icon-collapsed', :text => 'Show example' - assert_select_in result, 'a.collapsible.icon-expanded', :text => 'Hide example' + assert_select_in result, 'div.collapsed-text' + assert_select_in result, 'strong', :text => 'Collapsed' + assert_select_in result, 'a.collapsible.icon-collapsed', :text => 'Show example' + assert_select_in result, 'a.collapsible.icon-expanded', :text => 'Hide example' + end end def test_macro_collapse_should_not_break_toc @@ -264,7 +295,9 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest expected_toc = '<ul class="toc"><li><strong>Table of contents</strong></li>' \ '<li><a href="#Title">Title</a><ul><li><a href="#Heading">Heading</a></li></ul></li></ul>' - assert_include expected_toc, textilizable(text).gsub(/[\r\n]/, '') + with_settings :text_formatting => 'textile' do + assert_include expected_toc, textilizable(text).gsub(/[\r\n]/, '') + end end def test_macro_child_pages @@ -276,13 +309,15 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" \ "</ul>\n</p>" @project = Project.find(1) - # child pages of the current wiki page - assert_equal expected, textilizable("{{child_pages}}", :object => WikiPage.find(2).content) - # child pages of another page - assert_equal expected, textilizable("{{child_pages(Another_page)}}", :object => WikiPage.find(1).content) - - @project = Project.find(2) - assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page)}}", :object => WikiPage.find(1).content) + with_settings :text_formatting => 'textile' do + # child pages of the current wiki page + assert_equal expected, textilizable('{{child_pages}}', :object => WikiPage.find(2).content) + # child pages of another page + assert_equal expected, textilizable('{{child_pages(Another_page)}}', :object => WikiPage.find(1).content) + + @project = Project.find(2) + assert_equal expected, textilizable('{{child_pages(ecookbook:Another_page)}}', :object => WikiPage.find(1).content) + end end def test_macro_child_pages_with_parent_option @@ -297,18 +332,20 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest "</ul>\n</li>\n</ul>\n</p>" @project = Project.find(1) - # child pages of the current wiki page - assert_equal expected, textilizable("{{child_pages(parent=1)}}", :object => WikiPage.find(2).content) - # child pages of another page - assert_equal( - expected, - textilizable("{{child_pages(Another_page, parent=1)}}", :object => WikiPage.find(1).content) - ) - @project = Project.find(2) - assert_equal( - expected, - textilizable("{{child_pages(ecookbook:Another_page, parent=1)}}", :object => WikiPage.find(1).content) - ) + with_settings :text_formatting => 'textile' do + # child pages of the current wiki page + assert_equal expected, textilizable('{{child_pages(parent=1)}}', :object => WikiPage.find(2).content) + # child pages of another page + assert_equal( + expected, + textilizable('{{child_pages(Another_page, parent=1)}}', :object => WikiPage.find(1).content) + ) + @project = Project.find(2) + assert_equal( + expected, + textilizable('{{child_pages(ecookbook:Another_page, parent=1)}}', :object => WikiPage.find(1).content) + ) + end end def test_macro_child_pages_with_depth_option @@ -318,7 +355,9 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" \ "</ul>\n</p>" @project = Project.find(1) - assert_equal expected, textilizable("{{child_pages(depth=1)}}", :object => WikiPage.find(2).content) + with_settings :text_formatting => 'textile' do + assert_equal expected, textilizable("{{child_pages(depth=1)}}", :object => WikiPage.find(2).content) + end end def test_macro_child_pages_without_wiki_page_should_fail @@ -326,39 +365,47 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest end def test_macro_thumbnail - link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17/200" />'.html_safe, - "/attachments/17", - :class => "thumbnail", - :title => "testfile.PNG") - assert_equal "<p>#{link}</p>", - textilizable("{{thumbnail(testfile.png)}}", :object => Issue.find(14)) + with_settings :text_formatting => 'textile' do + link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17/200" />'.html_safe, + '/attachments/17', + :class => 'thumbnail', + :title => 'testfile.PNG') + assert_equal "<p>#{link}</p>", + textilizable('{{thumbnail(testfile.png)}}', :object => Issue.find(14)) + end end def test_macro_thumbnail_with_full_path - link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17/200" />'.html_safe, - "http://test.host/attachments/17", - :class => "thumbnail", - :title => "testfile.PNG") - assert_equal "<p>#{link}</p>", - textilizable("{{thumbnail(testfile.png)}}", :object => Issue.find(14), :only_path => false) + with_settings :text_formatting => 'textile' do + link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17/200" />'.html_safe, + 'http://test.host/attachments/17', + :class => 'thumbnail', + :title => 'testfile.PNG') + assert_equal "<p>#{link}</p>", + textilizable('{{thumbnail(testfile.png)}}', :object => Issue.find(14), :only_path => false) + end end def test_macro_thumbnail_with_size - link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17/400" />'.html_safe, - "/attachments/17", - :class => "thumbnail", - :title => "testfile.PNG") - assert_equal "<p>#{link}</p>", - textilizable("{{thumbnail(testfile.png, size=400)}}", :object => Issue.find(14)) + with_settings :text_formatting => 'textile' do + link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17/400" />'.html_safe, + '/attachments/17', + :class => 'thumbnail', + :title => 'testfile.PNG') + assert_equal "<p>#{link}</p>", + textilizable('{{thumbnail(testfile.png, size=400)}}', :object => Issue.find(14)) + end end def test_macro_thumbnail_with_title - link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17/200" />'.html_safe, - "/attachments/17", - :class => "thumbnail", - :title => "Cool image") - assert_equal "<p>#{link}</p>", - textilizable("{{thumbnail(testfile.png, title=Cool image)}}", :object => Issue.find(14)) + with_settings :text_formatting => 'textile' do + link = link_to('<img alt="testfile.PNG" src="/attachments/thumbnail/17/200" />'.html_safe, + '/attachments/17', + :class => 'thumbnail', + :title => 'Cool image') + assert_equal "<p>#{link}</p>", + textilizable('{{thumbnail(testfile.png, title=Cool image)}}', :object => Issue.find(14)) + end end def test_macro_thumbnail_with_invalid_filename_should_fail @@ -387,20 +434,26 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest <p>Hello world! Object: NilClass, Arguments: bar and no block of text.</p> EXPECTED - assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(text).gsub(%r{[\r\n\t]}, '') + with_settings :text_formatting => 'textile' do + assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(text).gsub(%r{[\r\n\t]}, '') + end end def test_macros_should_be_escaped_in_pre_tags - text = "<pre>{{hello_world(<tag>)}}</pre>" - assert_equal "<pre>{{hello_world(<tag>)}}</pre>", textilizable(text) + with_settings :text_formatting => 'textile' do + text = '<pre>{{hello_world(<tag>)}}</pre>' + assert_equal '<pre>{{hello_world(<tag>)}}</pre>', textilizable(text) + end end def test_macros_should_not_mangle_next_macros_outputs - text = '{{macro(2)}} !{{macro(2)}} {{hello_world(foo)}}' - assert_equal( - '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', - textilizable(text) - ) + with_settings :text_formatting => 'textile' do + text = '{{macro(2)}} !{{macro(2)}} {{hello_world(foo)}}' + assert_equal( + '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', + textilizable(text) + ) + end end def test_macros_with_text_should_not_mangle_following_macros @@ -421,26 +474,32 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest end def test_macro_should_support_phrase_modifiers - text = "*{{hello_world}}*" - assert_match %r|\A<p><strong>Hello world!.*</strong></p>\z|, textilizable(text) + with_settings :text_formatting => 'textile' do + text = '*{{hello_world}}*' + assert_match %r|\A<p><strong>Hello world!.*</strong></p>\z|, textilizable(text) + end end def test_issue_macro_should_not_render_link_if_not_visible - assert_equal "<p>#123</p>", textilizable('{{issue(123)}}') + with_settings :text_formatting => 'textile' do + assert_equal '<p>#123</p>', textilizable('{{issue(123)}}') + end end def test_issue_macro_should_render_link_to_issue issue = Issue.find(1) - assert_equal( - %{<p><a class="issue tracker-1 status-1 priority-4 priority-lowest behind-schedule" } + - %{href="/issues/1">Bug #1</a>: #{issue.subject}</p>}, - textilizable("{{issue(1)}}") - ) - assert_equal( - %{<p>eCookbook - } + - %{<a class="issue tracker-1 status-1 priority-4 priority-lowest behind-schedule" } + - %{href="/issues/1">Bug #1</a>: #{issue.subject}</p>}, - textilizable("{{issue(1, project=true)}}") - ) + with_settings :text_formatting => 'textile' do + assert_equal( + %{<p><a class="issue tracker-1 status-1 priority-4 priority-lowest behind-schedule" } + + %{href="/issues/1">Bug #1</a>: #{issue.subject}</p>}, + textilizable('{{issue(1)}}') + ) + assert_equal( + %{<p>eCookbook - } + + %{<a class="issue tracker-1 status-1 priority-4 priority-lowest behind-schedule" } + + %{href="/issues/1">Bug #1</a>: #{issue.subject}</p>}, + textilizable('{{issue(1, project=true)}}') + ) + end end end diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index 4e75ef874..7ee682c06 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -997,7 +997,7 @@ class MailerTest < ActiveSupport::TestCase end def test_layout_should_include_the_emails_header - with_settings :emails_header => "*Header content*" do + with_settings :emails_header => '*Header content*', :text_formatting => 'textile' do with_settings :plain_text_mail => 0 do assert Mailer.test_email(User.find(1)).deliver_now assert_select_email do @@ -1024,7 +1024,7 @@ class MailerTest < ActiveSupport::TestCase end def test_layout_should_include_the_emails_footer - with_settings :emails_footer => "*Footer content*" do + with_settings :emails_footer => '*Footer content*', :text_formatting => 'textile' do with_settings :plain_text_mail => 0 do assert Mailer.test_email(User.find(1)).deliver_now assert_select_email do |