Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bcb70222
Commit
bcb70222
authored
Aug 20, 2016
by
Timothy Andrew
Committed by
Alfredo Sumaran
Oct 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update protected branches feature spec to include group-based access levels.
parent
e7e9d41f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
5 deletions
+39
-5
spec/features/protected_branches/access_control_ee_spec.rb
spec/features/protected_branches/access_control_ee_spec.rb
+39
-5
No files found.
spec/features/protected_branches/access_control_ee_spec.rb
View file @
bcb70222
...
...
@@ -3,15 +3,22 @@ RSpec.shared_examples "protected branches > access control > EE" do
# Need to set a default for the `git_operation` access level that _isn't_ being tested
other_git_operation
=
git_operation
==
'merge'
?
'push'
:
'merge'
it
"allows creating protected branches that roles and users can
#{
git_operation
}
to"
do
users
=
create_list
(
:user
,
5
)
let
(
:users
)
{
create_list
(
:user
,
5
)
}
let
(
:groups
)
{
create_list
(
:group
,
5
)
}
before
do
users
.
each
{
|
user
|
project
.
team
<<
[
user
,
:developer
]
}
groups
.
each
{
|
group
|
project
.
project_group_links
.
create
(
group:
group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
}
end
it
"allows creating protected branches that roles, users, and groups can
#{
git_operation
}
to"
do
roles
=
access_level_class
.
human_access_levels
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
set_allowed_to
(
git_operation
,
users
.
map
(
&
:name
))
set_allowed_to
(
git_operation
,
groups
.
map
(
&
:name
))
set_allowed_to
(
git_operation
,
roles
.
values
)
set_allowed_to
(
other_git_operation
)
...
...
@@ -21,11 +28,10 @@ RSpec.shared_examples "protected branches > access control > EE" do
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
).
map
(
&
:access_level
)).
to
include
(
access_type_id
)
}
users
.
each
{
|
user
|
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
).
map
(
&
:user_id
)).
to
include
(
user
.
id
)
}
groups
.
each
{
|
group
|
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
).
map
(
&
:group_id
)).
to
include
(
group
.
id
)
}
end
it
"allows updating protected branches that roles and users can
#{
git_operation
}
to"
do
users
=
create_list
(
:user
,
5
)
users
.
each
{
|
user
|
project
.
team
<<
[
user
,
:developer
]
}
it
"allows updating protected branches so that roles and users can
#{
git_operation
}
to it"
do
roles
=
access_level_class
.
human_access_levels
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
...
...
@@ -36,7 +42,9 @@ RSpec.shared_examples "protected branches > access control > EE" do
click_on
"Protect"
within
(
".js-protected-branch-edit-form"
)
do
set_allowed_to
(
git_operation
,
users
.
map
(
&
:name
))
set_allowed_to
(
git_operation
,
groups
.
map
(
&
:name
))
set_allowed_to
(
git_operation
,
roles
.
values
)
end
...
...
@@ -45,6 +53,32 @@ RSpec.shared_examples "protected branches > access control > EE" do
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
).
map
(
&
:access_level
)).
to
include
(
access_type_id
)
}
users
.
each
{
|
user
|
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
).
map
(
&
:user_id
)).
to
include
(
user
.
id
)
}
groups
.
each
{
|
group
|
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
).
map
(
&
:group_id
)).
to
include
(
group
.
id
)
}
end
it
"allows updating protected branches so that roles and users cannot
#{
git_operation
}
to it"
do
roles
=
access_level_class
.
human_access_levels
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
users
.
each
{
|
user
|
set_allowed_to
(
git_operation
,
user
.
name
)
}
roles
.
each
{
|
(
_
,
access_type_name
)
|
set_allowed_to
(
git_operation
,
access_type_name
)
}
groups
.
each
{
|
group
|
set_allowed_to
(
git_operation
,
group
.
name
)
}
set_allowed_to
(
other_git_operation
)
click_on
"Protect"
within
(
".js-protected-branch-edit-form"
)
do
users
.
each
{
|
user
|
set_allowed_to
(
git_operation
,
user
.
name
)
}
groups
.
each
{
|
group
|
set_allowed_to
(
git_operation
,
group
.
name
)
}
roles
.
each
{
|
(
_
,
access_type_name
)
|
set_allowed_to
(
git_operation
,
access_type_name
)
}
end
wait_for_ajax
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
)).
to
be_empty
end
it
"prepends selected users that can
#{
git_operation
}
to"
do
...
...
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