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
9199449f
Commit
9199449f
authored
Jun 06, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Memoized access levels in ProtectedBranch EE specs
parent
e1643e6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
18 deletions
+28
-18
spec/support/shared_examples/features/protected_branches_access_control_ee_spec.rb
...les/features/protected_branches_access_control_ee_spec.rb
+28
-18
No files found.
spec/support/shared_examples/features/protected_branches_access_control_ee_spec.rb
View file @
9199449f
...
...
@@ -16,16 +16,16 @@ shared_examples "protected branches > access control > EE" do
ProtectedBranch
.
last
.
public_send
(
"
#{
git_operation
}
_access_levels"
)
end
def
access_levels
(
git_operation
)
access_
type_ids
(
git_operation
)
.
map
(
&
:access_level
)
def
access_levels
(
access_level_types
)
access_
level_types
.
map
(
&
:access_level
)
end
def
user_ids
(
git_operation
)
access_
type_ids
(
git_operation
)
.
map
(
&
:user_id
)
def
user_ids
(
access_level_types
)
access_
level_types
.
map
(
&
:user_id
)
end
def
group_ids
(
git_operation
)
access_
type_ids
(
git_operation
)
.
map
(
&
:group_id
)
def
group_ids
(
access_level_types
)
access_
level_types
.
map
(
&
:group_id
)
end
it
"allows creating protected branches that roles, users, and groups can
#{
git_operation
}
to"
do
...
...
@@ -41,9 +41,11 @@ 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
(
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
)
}
access_level_types
=
access_type_ids
(
git_operation
)
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
access_levels
(
access_level_types
)).
to
include
(
access_type_id
)
}
users
.
each
{
|
user
|
expect
(
user_ids
(
access_level_types
)).
to
include
(
user
.
id
)
}
groups
.
each
{
|
group
|
expect
(
group_ids
(
access_level_types
)).
to
include
(
group
.
id
)
}
end
it
"allows updating protected branches so that roles and users can
#{
git_operation
}
to it"
do
...
...
@@ -61,9 +63,11 @@ shared_examples "protected branches > access control > EE" do
wait_for_requests
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
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
)
}
access_level_types
=
access_type_ids
(
git_operation
)
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
access_levels
(
access_level_types
)).
to
include
(
access_type_id
)
}
users
.
each
{
|
user
|
expect
(
user_ids
(
access_level_types
)).
to
include
(
user
.
id
)
}
groups
.
each
{
|
group
|
expect
(
group_ids
(
access_level_types
)).
to
include
(
group
.
id
)
}
end
it
"allows updating protected branches so that roles and users cannot
#{
git_operation
}
to it"
do
...
...
@@ -84,7 +88,9 @@ shared_examples "protected branches > access control > EE" do
wait_for_requests
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
expect
(
access_type_ids
(
git_operation
)).
to
be_empty
access_level_types
=
access_type_ids
(
git_operation
)
expect
(
access_type_ids
(
access_level_types
)).
to
be_empty
end
it
"prepends selected users that can
#{
git_operation
}
to"
do
...
...
@@ -122,7 +128,9 @@ 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
(
access_levels
(
git_operation
)).
to
include
(
access_type_id
)
}
access_level_types
=
access_type_ids
(
git_operation
)
roles
.
each
{
|
(
access_type_id
,
_
)
|
expect
(
access_levels
(
access_level_types
)).
to
include
(
access_type_id
)
}
expect
(
user_ids
(
git_operation
)).
to
include
(
users
.
last
.
id
)
end
end
...
...
@@ -146,10 +154,11 @@ shared_examples "protected branches > access control > EE" do
wait_for_requests
access_level_types
=
access_type_ids
(
'push'
)
roles
.
each
do
|
(
access_type_id
,
_
)
|
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
not_to
include
(
access_type_id
)
expect
(
access_levels
(
access_level_types
)).
not_to
include
(
access_type_id
)
end
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
to
include
(
0
)
expect
(
access_levels
(
access_level_types
)).
to
include
(
0
)
end
end
...
...
@@ -163,10 +172,11 @@ shared_examples "protected branches > access control > EE" do
click_on
"Protect"
wait_for_requests
access_level_types
=
access_type_ids
(
'push'
)
roles
.
each
do
|
(
access_type_id
,
_
)
|
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
not_to
include
(
access_type_id
)
expect
(
access_levels
(
access_level_types
)).
not_to
include
(
access_type_id
)
end
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
to
include
(
0
)
expect
(
access_levels
(
access_level_types
)).
to
include
(
0
)
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