diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-11-09 02:20:09 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2019-11-09 02:20:09 +0000 |
commit | f11f3e6241e4075bd4c893839d8c83137620f670 (patch) | |
tree | fd880b2410607a69fc5d1cf6ed52b0b47bdf4fa7 | |
parent | 46e25379ffe4b4051bb265797bebdb268375953a (diff) | |
download | redmine-f11f3e6241e4075bd4c893839d8c83137620f670.tar.gz redmine-f11f3e6241e4075bd4c893839d8c83137620f670.zip |
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
-rw-r--r-- | test/helpers/application_helper_test.rb | 40 |
1 files changed, 30 insertions, 10 deletions
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 "<p>#{result}</p>", 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('<div class="contextual heading-2" title="Edit this section" id="section-4">' + '<a class="icon-only icon-edit" href="/projects/1/wiki/Test/edit\?section=4">Edit this section</a></div>' + @@ -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 |