From: Toshi MARUYAMA Date: Fri, 12 Apr 2013 01:18:40 +0000 (+0000) Subject: code layout clean up issues_helper_test.rb X-Git-Tag: 2.4.0~473 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c745acf4c230b79d1ba0b5a75fbc35f7e76306ce;p=redmine.git code layout clean up issues_helper_test.rb git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11713 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/unit/helpers/issues_helper_test.rb b/test/unit/helpers/issues_helper_test.rb index d202d28e0..7c8594d63 100644 --- a/test/unit/helpers/issues_helper_test.rb +++ b/test/unit/helpers/issues_helper_test.rb @@ -45,60 +45,67 @@ class IssuesHelperTest < ActionView::TestCase end def test_issues_destroy_confirmation_message_with_one_root_issue - assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find(1)) + assert_equal l(:text_issues_destroy_confirmation), + issues_destroy_confirmation_message(Issue.find(1)) end def test_issues_destroy_confirmation_message_with_an_arrayt_of_root_issues - assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2])) + assert_equal l(:text_issues_destroy_confirmation), + issues_destroy_confirmation_message(Issue.find([1, 2])) end def test_issues_destroy_confirmation_message_with_one_parent_issue Issue.find(2).update_attribute :parent_issue_id, 1 - assert_equal l(:text_issues_destroy_confirmation) + "\n" + l(:text_issues_destroy_descendants_confirmation, :count => 1), - issues_destroy_confirmation_message(Issue.find(1)) + assert_equal l(:text_issues_destroy_confirmation) + "\n" + + l(:text_issues_destroy_descendants_confirmation, :count => 1), + issues_destroy_confirmation_message(Issue.find(1)) end def test_issues_destroy_confirmation_message_with_one_parent_issue_and_its_child Issue.find(2).update_attribute :parent_issue_id, 1 - assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2])) + assert_equal l(:text_issues_destroy_confirmation), + issues_destroy_confirmation_message(Issue.find([1, 2])) end test 'IssuesHelper#show_detail with no_html should show a changing attribute' do - detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio') + detail = JournalDetail.new(:property => 'attr', :old_value => '40', + :value => '100', :prop_key => 'done_ratio') assert_equal "% Done changed from 40 to 100", show_detail(detail, true) end test 'IssuesHelper#show_detail with no_html should show a new attribute' do - detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio') + detail = JournalDetail.new(:property => 'attr', :old_value => nil, + :value => '100', :prop_key => 'done_ratio') assert_equal "% Done set to 100", show_detail(detail, true) end test 'IssuesHelper#show_detail with no_html should show a deleted attribute' do - detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio') + detail = JournalDetail.new(:property => 'attr', :old_value => '50', + :value => nil, :prop_key => 'done_ratio') assert_equal "% Done deleted (50)", show_detail(detail, true) end test 'IssuesHelper#show_detail with html should show a changing attribute with HTML highlights' do - detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio') + detail = JournalDetail.new(:property => 'attr', :old_value => '40', + :value => '100', :prop_key => 'done_ratio') html = show_detail(detail, false) - assert_include '% Done', html assert_include '40', html assert_include '100', html end test 'IssuesHelper#show_detail with html should show a new attribute with HTML highlights' do - detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio') + detail = JournalDetail.new(:property => 'attr', :old_value => nil, + :value => '100', :prop_key => 'done_ratio') html = show_detail(detail, false) - assert_include '% Done', html assert_include '100', html end test 'IssuesHelper#show_detail with html should show a deleted attribute with HTML highlights' do - detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio') + detail = JournalDetail.new(:property => 'attr', :old_value => '50', + :value => nil, :prop_key => 'done_ratio') html = show_detail(detail, false) - assert_include '% Done', html assert_include '50', html end @@ -130,65 +137,76 @@ class IssuesHelperTest < ActionView::TestCase end test 'IssuesHelper#show_detail should show old and new values with a project attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id', :old_value => 1, :value => 2) + detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id', + :old_value => 1, :value => 2) assert_match 'eCookbook', show_detail(detail, true) assert_match 'OnlineStore', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a issue status attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :old_value => 1, :value => 2) + detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id', + :old_value => 1, :value => 2) assert_match 'New', show_detail(detail, true) assert_match 'Assigned', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a tracker attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id', :old_value => 1, :value => 2) + detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id', + :old_value => 1, :value => 2) assert_match 'Bug', show_detail(detail, true) assert_match 'Feature request', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a assigned to attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', :old_value => 1, :value => 2) + detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', + :old_value => 1, :value => 2) assert_match 'Redmine Admin', show_detail(detail, true) assert_match 'John Smith', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a priority attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id', :old_value => 4, :value => 5) + detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id', + :old_value => 4, :value => 5) assert_match 'Low', show_detail(detail, true) assert_match 'Normal', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a category attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id', :old_value => 1, :value => 2) + detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id', + :old_value => 1, :value => 2) assert_match 'Printing', show_detail(detail, true) assert_match 'Recipes', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a fixed version attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id', :old_value => 1, :value => 2) + detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id', + :old_value => 1, :value => 2) assert_match '0.1', show_detail(detail, true) assert_match '1.0', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a estimated hours attribute' do - detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', :old_value => '5', :value => '6.3') + detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', + :old_value => '5', :value => '6.3') assert_match '5.00', show_detail(detail, true) assert_match '6.30', show_detail(detail, true) end test 'IssuesHelper#show_detail should show old and new values with a custom field' do - detail = JournalDetail.new(:property => 'cf', :prop_key => '1', :old_value => 'MySQL', :value => 'PostgreSQL') + detail = JournalDetail.new(:property => 'cf', :prop_key => '1', + :old_value => 'MySQL', :value => 'PostgreSQL') assert_equal 'Database changed from MySQL to PostgreSQL', show_detail(detail, true) end test 'IssuesHelper#show_detail should show added file' do - detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => nil, :value => 'error281.txt') + detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', + :old_value => nil, :value => 'error281.txt') assert_match 'error281.txt', show_detail(detail, true) end test 'IssuesHelper#show_detail should show removed file' do - detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => 'error281.txt', :value => nil) + detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', + :old_value => 'error281.txt', :value => nil) assert_match 'error281.txt', show_detail(detail, true) end end