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
e1643e6c
Commit
e1643e6c
authored
Jun 05, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup protected branch EE specs, removing unnecessary to_sym
parent
c86db115
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
spec/support/shared_examples/features/protected_branches_access_control_ee_spec.rb
...les/features/protected_branches_access_control_ee_spec.rb
+25
-9
No files found.
spec/support/shared_examples/features/protected_branches_access_control_ee_spec.rb
View file @
e1643e6c
...
...
@@ -12,6 +12,22 @@ shared_examples "protected branches > access control > EE" do
groups
.
each
{
|
group
|
project
.
project_group_links
.
create
(
group:
group
,
group_access:
Gitlab
::
Access
::
DEVELOPER
)
}
end
def
access_type_ids
(
git_operation
)
ProtectedBranch
.
last
.
public_send
(
"
#{
git_operation
}
_access_levels"
)
end
def
access_levels
(
git_operation
)
access_type_ids
(
git_operation
).
map
(
&
:access_level
)
end
def
user_ids
(
git_operation
)
access_type_ids
(
git_operation
).
map
(
&
:user_id
)
end
def
group_ids
(
git_operation
)
access_type_ids
(
git_operation
).
map
(
&
:group_id
)
end
it
"allows creating protected branches that roles, users, and groups can
#{
git_operation
}
to"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
...
...
@@ -25,9 +41,9 @@ shared_examples "protected branches > access control > EE" do
within
(
".protected-branches-list"
)
{
expect
(
page
).
to
have_content
(
'master'
)
}
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
)
}
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
access_levels
(
git_operation
)).
to
include
(
access_type_id
)
}
users
.
each
{
|
user
|
expect
(
user_ids
(
git_operation
)).
to
include
(
user
.
id
)
}
groups
.
each
{
|
group
|
expect
(
group_ids
(
git_operation
)).
to
include
(
group
.
id
)
}
end
it
"allows updating protected branches so that roles and users can
#{
git_operation
}
to it"
do
...
...
@@ -45,9 +61,9 @@ shared_examples "protected branches > access control > EE" do
wait_for_requests
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
)
}
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
access_levels
(
git_operation
)).
to
include
(
access_type_id
)
}
users
.
each
{
|
user
|
expect
(
user_ids
(
git_operation
)).
to
include
(
user
.
id
)
}
groups
.
each
{
|
group
|
expect
(
group_ids
(
git_operation
)).
to
include
(
group
.
id
)
}
end
it
"allows updating protected branches so that roles and users cannot
#{
git_operation
}
to it"
do
...
...
@@ -68,7 +84,7 @@ shared_examples "protected branches > access control > EE" do
wait_for_requests
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
)).
to
be_empty
expect
(
access_type_ids
(
git_operation
)).
to
be_empty
end
it
"prepends selected users that can
#{
git_operation
}
to"
do
...
...
@@ -106,8 +122,8 @@ shared_examples "protected branches > access control > EE" do
expect
(
page
).
to
have_selector
'.dropdown-content .is-active'
,
text:
users
.
last
.
name
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
)
}
expect
(
ProtectedBranch
.
last
.
send
(
"
#{
git_operation
}
_access_levels"
.
to_sym
).
map
(
&
:user_id
)).
to
include
(
users
.
last
.
id
)
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
access_levels
(
git_operation
)).
to
include
(
access_type_id
)
}
expect
(
user_ids
(
git_operation
)).
to
include
(
users
.
last
.
id
)
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