From f11f3e6241e4075bd4c893839d8c83137620f670 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 9 Nov 2019 02:20:09 +0000 Subject: code layout clean up test/helpers/application_helper_test.rb git-svn-id: http://svn.redmine.org/redmine/trunk@18980 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/helpers/application_helper_test.rb | 40 ++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'test/helpers') diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index a6733f7b0..77da9b06f 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -629,9 +629,14 @@ class ApplicationHelperTest < Redmine::HelperTest hg_changeset_link = link_to('ecookbook:hg1|abcd', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :repository_id => 'hg1', :rev => 'abcd'}, :class => 'changeset', :title => '') - source_link = link_to('ecookbook:source:some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 10, :path => ['some', 'file']}, :class => 'source') - hg_source_link = link_to('ecookbook:source:hg1|some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :repository_id => 'hg1', :path => ['some', 'file']}, :class => 'source') - + source_link = link_to('ecookbook:source:some/file', + {:controller => 'repositories', :action => 'entry', + :id => 'ecookbook', :repository_id => 10, + :path => ['some', 'file']}, :class => 'source') + hg_source_link = link_to('ecookbook:source:hg1|some/file', + {:controller => 'repositories', :action => 'entry', + :id => 'ecookbook', :repository_id => 'hg1', + :path => ['some', 'file']}, :class => 'source') to_test = { 'ecookbook:r2' => changeset_link, 'ecookbook:svn1|r123' => svn_changeset_link, @@ -645,7 +650,6 @@ class ApplicationHelperTest < Redmine::HelperTest 'ecookbook:source:invalid|some/file' => 'ecookbook:source:invalid|some/file', 'invalid:source:invalid|some/file' => 'invalid:source:invalid|some/file', } - @project = Project.find(3) to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text), "#{text} failed" } end @@ -1387,8 +1391,12 @@ class ApplicationHelperTest < Redmine::HelperTest RAW @project = Project.find(1) set_language_if_valid 'en' - result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "") - + result = textilizable( + raw, + :edit_section_links => + {:controller => 'wiki', :action => 'edit', + :project_id => '1', :id => 'Test'} + ).gsub("\n", "") # heading that contains inline code assert_match Regexp.new('
' + 'Edit this section
' + @@ -1446,8 +1454,14 @@ class ApplicationHelperTest < Redmine::HelperTest child_page = WikiPage.find_by(parent_id: parent_page.id) pages_by_parent_id = { nil => [parent_page], parent_page.id => [child_page] } result = render_page_hierarchy(pages_by_parent_id, nil) - assert_select_in result, 'ul.pages-hierarchy li a[href=?]', project_wiki_page_path(project_id: parent_page.project, id: parent_page.title, version: nil ) - assert_select_in result, 'ul.pages-hierarchy li ul.pages-hierarchy a[href=?]', project_wiki_page_path(project_id: child_page.project, id: child_page.title, version: nil ) + assert_select_in( + result, 'ul.pages-hierarchy li a[href=?]', + project_wiki_page_path(project_id: parent_page.project, + id: parent_page.title, version: nil)) + assert_select_in( + result, 'ul.pages-hierarchy li ul.pages-hierarchy a[href=?]', + project_wiki_page_path(project_id: child_page.project, + id: child_page.title, version: nil)) end def test_render_page_hierarchy_with_timestamp @@ -1455,8 +1469,14 @@ class ApplicationHelperTest < Redmine::HelperTest child_page = WikiPage.find_by(parent_id: parent_page.id) pages_by_parent_id = { nil => [parent_page], parent_page.id => [child_page] } result = render_page_hierarchy(pages_by_parent_id, nil, :timestamp => true) - assert_select_in result, 'ul.pages-hierarchy li a[title=?]', l(:label_updated_time, distance_of_time_in_words(Time.now, parent_page.updated_on)) - assert_select_in result, 'ul.pages-hierarchy li ul.pages-hierarchy a[title=?]', l(:label_updated_time, distance_of_time_in_words(Time.now, child_page.updated_on)) + assert_select_in( + result, 'ul.pages-hierarchy li a[title=?]', + l(:label_updated_time, + distance_of_time_in_words(Time.now, parent_page.updated_on))) + assert_select_in( + result, 'ul.pages-hierarchy li ul.pages-hierarchy a[title=?]', + l(:label_updated_time, + distance_of_time_in_words(Time.now, child_page.updated_on))) end def test_render_page_hierarchy_when_action_is_export -- cgit v1.2.3