summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-11-15 12:36:01 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-11-15 12:36:01 +0000
commit91a3b5102b0d531ae62094f4e88f907a63ce7eac (patch)
tree770328417e7497169f2f4fb369fdf97924e6fce3 /test
parent47ee0bfcc3899f8294db59470279e79b364eb1ff (diff)
downloadredmine-91a3b5102b0d531ae62094f4e88f907a63ce7eac.tar.gz
redmine-91a3b5102b0d531ae62094f4e88f907a63ce7eac.zip
fix source indent of MembersControllerTest
git-svn-id: http://svn.redmine.org/redmine/trunk@20377 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/members_controller_test.rb103
1 files changed, 58 insertions, 45 deletions
diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb
index 75f9491cb..53c5f2abc 100644
--- a/test/functional/members_controller_test.rb
+++ b/test/functional/members_controller_test.rb
@@ -28,9 +28,7 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_new
- get :new, :params => {
- :project_id => 1
- }
+ get(:new, :params => {:project_id => 1})
assert_response :success
end
@@ -39,9 +37,7 @@ class MembersControllerTest < Redmine::ControllerTest
role.update! :all_roles_managed => false
role.managed_roles = Role.where(:id => [2, 3]).to_a
- get :new, :params => {
- :project_id => 1
- }
+ get(:new, :params => {:project_id => 1})
assert_response :success
assert_select 'div.roles-selection' do
assert_select 'label', :text => 'Manager', :count => 0
@@ -51,23 +47,23 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_xhr_new
- get :new, :params => {
- :project_id => 1
- },
- :xhr => true
+ get(:new, :params => {:project_id => 1}, :xhr => true)
assert_response :success
assert_equal 'text/javascript', response.media_type
end
def test_create
assert_difference 'Member.count' do
- post :create, :params => {
+ post(
+ :create,
+ :params => {
:project_id => 1,
:membership => {
:role_ids => [1],
:user_id => 7
}
}
+ )
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert User.find(7).member_of?(Project.find(1))
@@ -75,13 +71,16 @@ class MembersControllerTest < Redmine::ControllerTest
def test_create_multiple
assert_difference 'Member.count', 3 do
- post :create, :params => {
+ post(
+ :create,
+ :params => {
:project_id => 1,
:membership => {
:role_ids => [1],
:user_ids => [7, 8, 9]
}
}
+ )
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert User.find(7).member_of?(Project.find(1))
@@ -93,13 +92,16 @@ class MembersControllerTest < Redmine::ControllerTest
role.managed_roles = Role.where(:id => [2, 3]).to_a
assert_difference 'Member.count' do
- post :create, :params => {
+ post(
+ :create,
+ :params => {
:project_id => 1,
:membership => {
:role_ids => [1, 2],
:user_id => 7
}
}
+ )
end
member = Member.order(:id => :desc).first
assert_equal [2], member.role_ids
@@ -110,13 +112,16 @@ class MembersControllerTest < Redmine::ControllerTest
@request.session[:user_id] = 1
assert_difference 'Member.count' do
- post :create, :params => {
+ post(
+ :create,
+ :params => {
:project_id => 1,
:membership => {
:role_ids => [1, 2],
:user_id => 7
}
}
+ )
end
member = Member.order(:id => :desc).first
assert_equal [1, 2], member.role_ids
@@ -124,7 +129,9 @@ class MembersControllerTest < Redmine::ControllerTest
def test_xhr_create
assert_difference 'Member.count', 3 do
- post :create, :params => {
+ post(
+ :create,
+ :params => {
:project_id => 1,
:membership => {
:role_ids => [1],
@@ -132,6 +139,7 @@ class MembersControllerTest < Redmine::ControllerTest
}
},
:xhr => true
+ )
assert_response :success
assert_equal 'text/javascript', response.media_type
end
@@ -143,7 +151,9 @@ class MembersControllerTest < Redmine::ControllerTest
def test_xhr_create_with_failure
assert_no_difference 'Member.count' do
- post :create, :params => {
+ post(
+ :create,
+ :params => {
:project_id => 1,
:membership => {
:role_ids => [],
@@ -151,6 +161,7 @@ class MembersControllerTest < Redmine::ControllerTest
}
},
:xhr => true
+ )
assert_response :success
assert_equal 'text/javascript', response.media_type
end
@@ -158,30 +169,28 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_edit
- get :edit, :params => {
- :id => 2
- }
+ get(:edit, :params => {:id => 2})
assert_response :success
assert_select 'input[name=?][value=?][checked=checked]', 'membership[role_ids][]', '2'
end
def test_xhr_edit
- get :edit, :params => {
- :id => 2
- },
- :xhr => true
+ get(:edit, :params => {:id => 2}, :xhr => true)
assert_response :success
end
def test_update
assert_no_difference 'Member.count' do
- put :update, :params => {
+ put(
+ :update,
+ :params => {
:id => 2,
:membership => {
:role_ids => [1],
:user_id => 3
}
}
+ )
end
assert_redirected_to '/projects/ecookbook/settings/members'
end
@@ -189,12 +198,15 @@ class MembersControllerTest < Redmine::ControllerTest
def test_update_locked_member_should_be_allowed
User.find(3).lock!
- put :update, :params => {
+ put(
+ :update,
+ :params => {
:id => 2,
:membership => {
:role_ids => [1]
}
}
+ )
assert_response 302
member = Member.find(2)
assert member.user.locked?
@@ -207,12 +219,15 @@ class MembersControllerTest < Redmine::ControllerTest
role.managed_roles = Role.where(:id => [2, 3]).to_a
member = Member.create!(:user => User.find(9), :role_ids => [3], :project_id => 1)
- put :update, :params => {
+ put(
+ :update,
+ :params => {
:id => member.id,
:membership => {
:role_ids => [1, 2, 3]
}
}
+ )
assert_equal [2, 3], member.reload.role_ids.sort
end
@@ -222,18 +237,23 @@ class MembersControllerTest < Redmine::ControllerTest
role.managed_roles = Role.where(:id => [2, 3]).to_a
member = Member.create!(:user => User.find(9), :role_ids => [1, 3], :project_id => 1)
- put :update, :params => {
+ put(
+ :update,
+ :params => {
:id => member.id,
:membership => {
:role_ids => [2]
}
}
+ )
assert_equal [1, 2], member.reload.role_ids.sort
end
def test_xhr_update
assert_no_difference 'Member.count' do
- put :update, :params => {
+ put(
+ :update,
+ :params => {
:id => 2,
:membership => {
:role_ids => [1],
@@ -241,6 +261,7 @@ class MembersControllerTest < Redmine::ControllerTest
}
},
:xhr => true
+ )
assert_response :success
assert_equal 'text/javascript', response.media_type
end
@@ -252,9 +273,7 @@ class MembersControllerTest < Redmine::ControllerTest
def test_destroy
assert_difference 'Member.count', -1 do
- delete :destroy, :params => {
- :id => 2
- }
+ delete(:destroy, :params => {:id => 2})
end
assert_redirected_to '/projects/ecookbook/settings/members'
assert !User.find(3).member_of?(Project.find(1))
@@ -264,9 +283,7 @@ class MembersControllerTest < Redmine::ControllerTest
assert User.find(3).lock!
assert_difference 'Member.count', -1 do
- delete :destroy, :params => {
- :id => 2
- }
+ delete(:destroy, :params => {:id => 2})
end
end
@@ -277,9 +294,7 @@ class MembersControllerTest < Redmine::ControllerTest
member = Member.create!(:user => User.find(9), :role_ids => [1, 3], :project_id => 1)
assert_no_difference 'Member.count' do
- delete :destroy, :params => {
- :id => member.id
- }
+ delete(:destroy, :params => {:id => member.id})
end
end
@@ -290,18 +305,13 @@ class MembersControllerTest < Redmine::ControllerTest
member = Member.create!(:user => User.find(9), :role_ids => [3], :project_id => 1)
assert_difference 'Member.count', -1 do
- delete :destroy, :params => {
- :id => member.id
- }
+ delete(:destroy, :params => {:id => member.id})
end
end
def test_xhr_destroy
assert_difference 'Member.count', -1 do
- delete :destroy, :params => {
- :id => 2
- },
- :xhr => true
+ delete(:destroy, :params => {:id => 2}, :xhr => true)
assert_response :success
assert_equal 'text/javascript', response.media_type
end
@@ -310,12 +320,15 @@ class MembersControllerTest < Redmine::ControllerTest
end
def test_autocomplete
- get :autocomplete, :params => {
+ get(
+ :autocomplete,
+ :params => {
:project_id => 1,
:q => 'mis',
:format => 'js'
},
:xhr => true
+ )
assert_response :success
assert_include 'User Misc', response.body
end