diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-11-30 15:49:14 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-11-30 15:49:14 +0000 |
commit | 65425463f1e1d2eda3846fb541e3ac9c86126de0 (patch) | |
tree | 373c8eeabf9b179f60d950315f14eb53a107512d /test | |
parent | 8f542b20f435c80f39a6122ae9ca217c55ebbac2 (diff) | |
download | redmine-65425463f1e1d2eda3846fb541e3ac9c86126de0.tar.gz redmine-65425463f1e1d2eda3846fb541e3ac9c86126de0.zip |
shorten long line of test/unit/lib/redmine/wiki_formatting/macros_test.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20527 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/lib/redmine/wiki_formatting/macros_test.rb | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb index 27d2f7133..2cfa3e7a7 100644 --- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb @@ -252,19 +252,20 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest h2. Heading }}" RAW - - 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>' - + 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]/, '') end def test_macro_child_pages - expected = "<p><ul class=\"pages-hierarchy\">\n" + - "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" + - "<ul class=\"pages-hierarchy\">\n<li><a href=\"/projects/ecookbook/wiki/Child_1_1\">Child 1 1</a></li>\n</ul>\n</li>\n" + - "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" + - "</ul>\n</p>" - + expected = + "<p><ul class=\"pages-hierarchy\">\n" \ + "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" \ + "<ul class=\"pages-hierarchy\">\n" \ + "<li><a href=\"/projects/ecookbook/wiki/Child_1_1\">Child 1 1</a></li>\n</ul>\n</li>\n" \ + "<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) @@ -276,22 +277,29 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest end def test_macro_child_pages_with_parent_option - expected = "<p><ul class=\"pages-hierarchy\">\n" + - "<li><a href=\"/projects/ecookbook/wiki/Another_page\">Another page</a>\n" + - "<ul class=\"pages-hierarchy\">\n" + - "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" + - "<ul class=\"pages-hierarchy\">\n<li><a href=\"/projects/ecookbook/wiki/Child_1_1\">Child 1 1</a></li>\n</ul>\n</li>\n" + - "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" + - "</ul>\n</li>\n</ul>\n</p>" + expected = + "<p><ul class=\"pages-hierarchy\">\n" \ + "<li><a href=\"/projects/ecookbook/wiki/Another_page\">Another page</a>\n" \ + "<ul class=\"pages-hierarchy\">\n" \ + "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" \ + "<ul class=\"pages-hierarchy\">\n" \ + "<li><a href=\"/projects/ecookbook/wiki/Child_1_1\">Child 1 1</a></li>\n</ul>\n</li>\n" \ + "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" \ + "</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) - + 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) + assert_equal( + expected, + textilizable("{{child_pages(ecookbook:Another_page, parent=1)}}", :object => WikiPage.find(1).content) + ) end def test_macro_child_pages_with_depth_option @@ -380,7 +388,10 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest 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) + assert_equal( + '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', + textilizable(text) + ) end def test_macros_with_text_should_not_mangle_following_macros @@ -410,8 +421,17 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest 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)}}") + 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)}}") + ) end end |