diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-11-30 15:49:21 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-11-30 15:49:21 +0000 |
commit | e23eeb8795cf15aa571285aa79f219cafc7879a0 (patch) | |
tree | 9d1d4ef0d0a6dc8055d9a3adf2559767e7b5ad15 /test | |
parent | 65425463f1e1d2eda3846fb541e3ac9c86126de0 (diff) | |
download | redmine-e23eeb8795cf15aa571285aa79f219cafc7879a0.tar.gz redmine-e23eeb8795cf15aa571285aa79f219cafc7879a0.zip |
shorten long line of TimelogControllerTest
git-svn-id: http://svn.redmine.org/redmine/trunk@20528 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/timelog_controller_test.rb | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 2171bf45a..455dafe2f 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -1133,10 +1133,29 @@ class TimelogControllerTest < Redmine::ControllerTest end def test_index_should_sort_by_spent_on_and_created_on - t1 = TimeEntry.create!(:author => User.find(1), :user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:00:00', :activity_id => 10) - t2 = TimeEntry.create!(:author => User.find(1), :user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:05:00', :activity_id => 10) - t3 = TimeEntry.create!(:author => User.find(1), :user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-15', :created_on => '2012-06-16 20:10:00', :activity_id => 10) - + t1 = + TimeEntry.create!( + :author => User.find(1), :user => User.find(1), + :project => Project.find(1), + :hours => 1, + :spent_on => '2012-06-16', :created_on => '2012-06-16 20:00:00', + :activity_id => 10 + ) + t2 = + TimeEntry.create!( + :author => User.find(1), :user => User.find(1), + :project => Project.find(1), + :hours => 1, + :spent_on => '2012-06-16', :created_on => '2012-06-16 20:05:00', + :activity_id => 10 + ) + t3 = + TimeEntry.create!( + :author => User.find(1), :user => User.find(1), + :project => Project.find(1), + :hours => 1, :spent_on => '2012-06-15', :created_on => '2012-06-16 20:10:00', + :activity_id => 10 + ) get :index, :params => { :project_id => 1, :f => ['spent_on'], @@ -1144,8 +1163,10 @@ class TimelogControllerTest < Redmine::ControllerTest :v => {'spent_on' => ['2012-06-15', '2012-06-16']} } assert_response :success - assert_equal [t2, t1, t3].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr('value')} - + assert_equal( + [t2, t1, t3].map(&:id).map(&:to_s), + css_select('input[name="ids[]"]').map {|e| e.attr('value')} + ) get( :index, :params => { @@ -1157,7 +1178,10 @@ class TimelogControllerTest < Redmine::ControllerTest } ) assert_response :success - assert_equal [t3, t1, t2].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr('value')} + assert_equal( + [t3, t1, t2].map(&:id).map(&:to_s), + css_select('input[name="ids[]"]').map {|e| e.attr('value')} + ) end def test_index_with_activity_filter @@ -1381,7 +1405,11 @@ class TimelogControllerTest < Redmine::ControllerTest end def test_index_with_filter_on_issue_custom_field - issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {2 => 'filter_on_issue_custom_field'}) + issue = + Issue.generate!( + :project_id => 1, :tracker_id => 1, + :custom_field_values => {2 => 'filter_on_issue_custom_field'} + ) entry = TimeEntry.generate!(:issue => issue, :hours => 2.5) get :index, :params => { @@ -1390,11 +1418,18 @@ class TimelogControllerTest < Redmine::ControllerTest :v => {'issue.cf_2' => ['filter_on_issue_custom_field']} } assert_response :success - assert_equal [entry].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr('value')} + assert_equal( + [entry].map(&:id).map(&:to_s), + css_select('input[name="ids[]"]').map {|e| e.attr('value')} + ) end def test_index_with_issue_custom_field_column - issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {2 => 'filter_on_issue_custom_field'}) + issue = + Issue.generate!( + :project_id => 1, :tracker_id => 1, + :custom_field_values => {2 => 'filter_on_issue_custom_field'} + ) entry = TimeEntry.generate!(:issue => issue, :hours => 2.5) get :index, :params => { @@ -1438,8 +1473,15 @@ class TimelogControllerTest < Redmine::ControllerTest def test_index_with_invalid_date_filter_should_not_validate @request.session[:user_id] = 2 - - get :index, :params => {:set_filter => '1', :f => ['spent_on'], :op => {'spent_on' => '='}, :v => {'spent_on' => ['2016-09-010']}} + get( + :index, + :params => { + :set_filter => '1', + :f => ['spent_on'], + :op => {'spent_on' => '='}, + :v => {'spent_on' => ['2016-09-010']} + } + ) assert_select_error 'Date is invalid' assert_select 'table.time-entries', 0 end |