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
da0d263a
Commit
da0d263a
authored
Feb 14, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE-specific code from spec/factories/protected_branches.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
ab90a49c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
35 deletions
+54
-35
ee/spec/factories/protected_branches.rb
ee/spec/factories/protected_branches.rb
+54
-0
spec/factories/protected_branches.rb
spec/factories/protected_branches.rb
+0
-35
No files found.
ee/spec/factories/protected_branches.rb
0 → 100644
View file @
da0d263a
# frozen_string_literal: true
FactoryBot
.
modify
do
factory
:protected_branch
do
transient
do
authorize_user_to_push
nil
authorize_user_to_merge
nil
authorize_user_to_unprotect
nil
authorize_group_to_push
nil
authorize_group_to_merge
nil
authorize_group_to_unprotect
nil
end
after
(
:build
)
do
|
protected_branch
,
evaluator
|
# Clear access levels set in CE
protected_branch
.
push_access_levels
.
clear
protected_branch
.
merge_access_levels
.
clear
if
user
=
evaluator
.
authorize_user_to_push
protected_branch
.
push_access_levels
.
new
(
user:
user
)
end
if
user
=
evaluator
.
authorize_user_to_merge
protected_branch
.
merge_access_levels
.
new
(
user:
user
)
end
if
user
=
evaluator
.
authorize_user_to_unprotect
protected_branch
.
unprotect_access_levels
.
new
(
user:
user
)
end
if
group
=
evaluator
.
authorize_group_to_push
protected_branch
.
push_access_levels
.
new
(
group:
group
)
end
if
group
=
evaluator
.
authorize_group_to_merge
protected_branch
.
merge_access_levels
.
new
(
group:
group
)
end
if
group
=
evaluator
.
authorize_group_to_unprotect
protected_branch
.
unprotect_access_levels
.
new
(
group:
group
)
end
next
unless
protected_branch
.
merge_access_levels
.
empty?
if
evaluator
.
default_access_level
&&
evaluator
.
default_push_level
protected_branch
.
push_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MAINTAINER
)
end
if
evaluator
.
default_access_level
&&
evaluator
.
default_merge_level
protected_branch
.
merge_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MAINTAINER
)
end
end
end
end
spec/factories/protected_branches.rb
View file @
da0d263a
...
...
@@ -4,14 +4,6 @@ FactoryBot.define do
project
transient
do
# EE
authorize_user_to_push
nil
authorize_user_to_merge
nil
authorize_user_to_unprotect
nil
authorize_group_to_push
nil
authorize_group_to_merge
nil
authorize_group_to_unprotect
nil
default_push_level
true
default_merge_level
true
default_access_level
true
...
...
@@ -58,33 +50,6 @@ FactoryBot.define do
end
after
(
:build
)
do
|
protected_branch
,
evaluator
|
# EE
if
user
=
evaluator
.
authorize_user_to_push
protected_branch
.
push_access_levels
.
new
(
user:
user
)
end
if
user
=
evaluator
.
authorize_user_to_merge
protected_branch
.
merge_access_levels
.
new
(
user:
user
)
end
if
user
=
evaluator
.
authorize_user_to_unprotect
protected_branch
.
unprotect_access_levels
.
new
(
user:
user
)
end
if
group
=
evaluator
.
authorize_group_to_push
protected_branch
.
push_access_levels
.
new
(
group:
group
)
end
if
group
=
evaluator
.
authorize_group_to_merge
protected_branch
.
merge_access_levels
.
new
(
group:
group
)
end
if
group
=
evaluator
.
authorize_group_to_unprotect
protected_branch
.
unprotect_access_levels
.
new
(
group:
group
)
end
next
unless
protected_branch
.
merge_access_levels
.
empty?
if
evaluator
.
default_access_level
&&
evaluator
.
default_push_level
protected_branch
.
push_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MAINTAINER
)
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