From 088e8ff00a62e834193a2b875ae1f8f01108347b Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 6 Nov 2020 12:59:57 +0000 Subject: [PATCH] fix source indent of PrincipalMembershipsControllerTest git-svn-id: http://svn.redmine.org/redmine/trunk@20271 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../principal_memberships_controller_test.rb | 108 ++++++++++++------ 1 file changed, 76 insertions(+), 32 deletions(-) diff --git a/test/functional/principal_memberships_controller_test.rb b/test/functional/principal_memberships_controller_test.rb index 54e9494d0..e0376e76e 100644 --- a/test/functional/principal_memberships_controller_test.rb +++ b/test/functional/principal_memberships_controller_test.rb @@ -27,9 +27,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest end def test_new_user_membership - get :new, :params => { - :user_id => 7 - } + get(:new, :params => {:user_id => 7}) assert_response :success assert_select 'label', :text => 'eCookbook' do assert_select 'input[name=?][value="1"]:not([disabled])', 'membership[project_ids][]' @@ -39,9 +37,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_new_user_membership_should_disable_user_projects Member.create!(:user_id => 7, :project_id => 1, :role_ids => [1]) - get :new, :params => { - :user_id => 7 - } + get(:new, :params => {:user_id => 7}) assert_response :success assert_select 'label', :text => 'eCookbook' do assert_select 'input[name=?][value="1"][disabled=disabled]', 'membership[project_ids][]' @@ -49,23 +45,23 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest end def test_xhr_new_user_membership - get :new, :params => { - :user_id => 7 - }, - :xhr => true + get(:new, :params => {:user_id => 7}, :xhr => true) assert_response :success assert_equal 'text/javascript', response.media_type end def test_create_user_membership assert_difference 'Member.count' do - post :create, :params => { + post( + :create, + :params => { :user_id => 7, :membership => { :project_ids => [3], :role_ids => [2] } } + ) end assert_redirected_to '/users/7/edit?tab=memberships' member = Member.order('id DESC').first @@ -76,13 +72,16 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_create_user_membership_with_multiple_roles assert_difference 'Member.count' do - post :create, :params => { + post( + :create, + :params => { :user_id => 7, :membership => { :project_ids => [3], :role_ids => [2, 3] } } + ) end member = Member.order('id DESC').first assert_equal User.find(7), member.principal @@ -92,13 +91,16 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_create_user_membership_with_multiple_projects_and_roles assert_difference 'Member.count', 2 do - post :create, :params => { + post( + :create, + :params => { :user_id => 7, :membership => { :project_ids => [1, 3], :role_ids => [2, 3] } } + ) end members = Member.order('id DESC').limit(2).sort_by(&:project_id) assert_equal 1, members[0].project_id @@ -111,7 +113,9 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_xhr_create_user_membership assert_difference 'Member.count' do - post :create, :params => { + post( + :create, + :params => { :user_id => 7, :membership => { :project_ids => [3], @@ -120,6 +124,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest :format => 'js' }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end @@ -132,7 +137,9 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_xhr_create_user_membership_with_failure assert_no_difference 'Member.count' do - post :create, :params => { + post( + :create, + :params => { :user_id => 7, :membership => { :project_ids => [3] @@ -140,6 +147,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest :format => 'js' }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end @@ -148,32 +156,41 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest end def test_edit_user_membership - get :edit, :params => { + get( + :edit, + :params => { :user_id => 2, :id => 1 } + ) assert_response :success assert_select 'input[name=?][value=?][checked=checked]', 'membership[role_ids][]', '1' end def test_xhr_edit_user_membership - get :edit, :params => { + get( + :edit, + :params => { :user_id => 2, :id => 1 }, :xhr => true + ) assert_response :success end def test_update_user_membership assert_no_difference 'Member.count' do - put :update, :params => { + put( + :update, + :params => { :user_id => 2, :id => 1, :membership => { :role_ids => [2] } } + ) assert_redirected_to '/users/2/edit?tab=memberships' end assert_equal [2], Member.find(1).role_ids @@ -181,7 +198,9 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_xhr_update_user_membership assert_no_difference 'Member.count' do - put :update, :params => { + put( + :update, + :params => { :user_id => 2, :id => 1, :membership => { @@ -190,6 +209,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest :format => 'js' }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end @@ -199,10 +219,13 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_destroy_user_membership assert_difference 'Member.count', -1 do - delete :destroy, :params => { + delete( + :destroy, + :params => { :user_id => 2, :id => 1 } + ) end assert_redirected_to '/users/2/edit?tab=memberships' assert_nil Member.find_by_id(1) @@ -210,11 +233,14 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_xhr_destroy_user_membership_js_format assert_difference 'Member.count', -1 do - delete :destroy, :params => { + delete( + :destroy, + :params => { :user_id => 2, :id => 1 }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end @@ -223,29 +249,31 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest end def test_xhr_new_group_membership - get :new, :params => { - :group_id => 10 - }, - :xhr => true + get(:new, :params => {:group_id => 10}, :xhr => true) assert_response :success assert_equal 'text/javascript', response.media_type end def test_create_group_membership assert_difference 'Group.find(10).members.count' do - post :create, :params => { + post( + :create, + :params => { :group_id => 10, :membership => { :project_ids => [2], :role_ids => ['1', '2'] } } + ) end end def test_xhr_create_group_membership assert_difference 'Group.find(10).members.count' do - post :create, :params => { + post( + :create, + :params => { :group_id => 10, :membership => { :project_ids => [2], @@ -253,6 +281,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest } }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end @@ -261,7 +290,9 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_xhr_create_group_membership_with_failure assert_no_difference 'Group.find(10).members.count' do - post :create, :params => { + post( + :create, + :params => { :group_id => 10, :membership => { :project_ids => [999], @@ -269,6 +300,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest } }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end @@ -277,19 +309,24 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_update_group_membership assert_no_difference 'Group.find(10).members.count' do - put :update, :params => { + put( + :update, + :params => { :group_id => 10, :id => 6, :membership => { :role_ids => ['1', '3'] } } + ) end end def test_xhr_update_group_membership assert_no_difference 'Group.find(10).members.count' do - post :update, :params => { + post( + :update, + :params => { :group_id => 10, :id => 6, :membership => { @@ -297,6 +334,7 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest } }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end @@ -304,20 +342,26 @@ class PrincipalMembershipsControllerTest < Redmine::ControllerTest def test_destroy_group_membership assert_difference 'Group.find(10).members.count', -1 do - delete :destroy, :params => { + delete( + :destroy, + :params => { :group_id => 10, :id => 6 } + ) end end def test_xhr_destroy_group_membership assert_difference 'Group.find(10).members.count', -1 do - delete :destroy, :params => { + delete( + :destroy, + :params => { :group_id => 10, :id => 6 }, :xhr => true + ) assert_response :success assert_equal 'text/javascript', response.media_type end -- 2.39.5