BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
bae16440
Unverified
Commit
bae16440
authored
Apr 20, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor Admin::GroupsController#members_update method and add some specs
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9e4908af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
groups_controller.rb
app/controllers/admin/groups_controller.rb
+6
-2
dz-refactor-admin-group-members.yml
changelogs/unreleased/dz-refactor-admin-group-members.yml
+4
-0
groups_controller_spec.rb
spec/controllers/admin/groups_controller_spec.rb
+24
-0
No files found.
app/controllers/admin/groups_controller.rb
View file @
bae16440
...
...
@@ -43,9 +43,13 @@ class Admin::GroupsController < Admin::ApplicationController
end
def
members_update
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
],
current_user:
current_user
)
status
=
Members
::
CreateService
.
new
(
@group
,
current_user
,
params
).
execute
redirect_to
[
:admin
,
@group
],
notice:
'Users were successfully added.'
if
status
redirect_to
[
:admin
,
@group
],
notice:
'Users were successfully added.'
else
redirect_to
[
:admin
,
@group
],
alert:
'No users specified.'
end
end
def
destroy
...
...
changelogs/unreleased/dz-refactor-admin-group-members.yml
0 → 100644
View file @
bae16440
---
title
:
Refactor Admin::GroupsController#members_update method and add some specs
merge_request
:
10735
author
:
spec/controllers/admin/groups_controller_spec.rb
View file @
bae16440
...
...
@@ -22,4 +22,28 @@ describe Admin::GroupsController do
expect
(
response
).
to
redirect_to
(
admin_groups_path
)
end
end
describe
'PUT #members_update'
do
let
(
:group_user
)
{
create
(
:user
)
}
it
'adds user to members'
do
put
:members_update
,
id:
group
,
user_ids:
group_user
.
id
,
access_level:
Gitlab
::
Access
::
GUEST
expect
(
response
).
to
set_flash
.
to
'Users were successfully added.'
expect
(
response
).
to
redirect_to
(
admin_group_path
(
group
))
expect
(
group
.
users
).
to
include
group_user
end
it
'adds no user to members'
do
put
:members_update
,
id:
group
,
user_ids:
''
,
access_level:
Gitlab
::
Access
::
GUEST
expect
(
response
).
to
set_flash
.
to
'No users specified.'
expect
(
response
).
to
redirect_to
(
admin_group_path
(
group
))
expect
(
group
.
users
).
not_to
include
group_user
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment