Patch #43640 » 02-tests-group-controller-remove_users.patch
| test/fixtures/groups_users.yml (working copy) | ||
|---|---|---|
|
groups_users_002:
|
||
|
group_id: 11
|
||
|
user_id: 8
|
||
|
groups_users_003:
|
||
|
group_id: 10
|
||
|
user_id: 9
|
||
| test/functional/groups_controller_test.rb (working copy) | ||
|---|---|---|
|
assert_match /John Smith/, response.body
|
||
|
end
|
||
|
|
||
|
def test_remove_user
|
||
|
def test_remove_users
|
||
|
assert_difference 'Group.find(10).users.count', -1 do
|
||
|
delete(
|
||
|
:remove_user,
|
||
|
:remove_users,
|
||
|
:params => {
|
||
|
:id => 10,
|
||
|
:user_id => '8'
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
|
||
|
def test_xhr_remove_user
|
||
|
def test_xhr_remove_users
|
||
|
assert_difference 'Group.find(10).users.count', -1 do
|
||
|
delete(
|
||
|
:remove_user,
|
||
|
:remove_users,
|
||
|
:params => {
|
||
|
:id => 10,
|
||
|
:user_id => '8'
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
|
||
|
def test_remove_users_patch
|
||
|
assert_difference 'Group.find(10).users.count', -2 do
|
||
|
patch(
|
||
|
:remove_users,
|
||
|
:params => {
|
||
|
:id => 10,
|
||
|
:user_ids => ['8', '9']
|
||
|
}
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_xhr_remove_users_patch
|
||
|
assert_difference 'Group.find(10).users.count', -2 do
|
||
|
patch(
|
||
|
:remove_users,
|
||
|
:params => {
|
||
|
:id => 10,
|
||
|
:user_ids => ['8', '9']
|
||
|
},
|
||
|
:xhr => true
|
||
|
)
|
||
|
assert_response :success
|
||
|
assert_equal 'text/javascript', response.media_type
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_autocomplete_for_user
|
||
|
get(
|
||
|
:autocomplete_for_user,
|
||
| test/integration/api_test/api_routing_test.rb (working copy) | ||
|---|---|---|
|
|
||
|
def test_group_users
|
||
|
should_route 'POST /groups/567/users' => 'groups#add_users', :id => '567'
|
||
|
should_route 'DELETE /groups/567/users/12' => 'groups#remove_user', :id => '567', :user_id => '12'
|
||
|
should_route 'DELETE /groups/567/users/12' => 'groups#remove_users', :id => '567', :user_id => '12'
|
||
|
should_route 'POST /groups/567/remove_users' => 'groups#remove_users', :id => '567'
|
||
|
end
|
||
|
|
||
|
def test_issue_categories
|
||
| test/integration/routing/groups_test.rb (working copy) | ||
|---|---|---|
|
def test_group_users
|
||
|
should_route 'GET /groups/567/users/new' => 'groups#new_users', :id => '567'
|
||
|
should_route 'POST /groups/567/users' => 'groups#add_users', :id => '567'
|
||
|
should_route 'DELETE /groups/567/users/12' => 'groups#remove_user', :id => '567', :user_id => '12'
|
||
|
should_route 'DELETE /groups/567/users/12' => 'groups#remove_users', :id => '567', :user_id => '12'
|
||
|
should_route 'POST /groups/567/remove_users' => 'groups#remove_users', :id => '567'
|
||
|
end
|
||
|
end
|
||