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
58171a67
Commit
58171a67
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_tags.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
da0d263a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
13 deletions
+50
-13
ee/spec/factories/protected_tags.rb
ee/spec/factories/protected_tags.rb
+50
-0
spec/factories/protected_tags.rb
spec/factories/protected_tags.rb
+0
-13
No files found.
ee/spec/factories/protected_tags.rb
0 → 100644
View file @
58171a67
# frozen_string_literal: true
FactoryBot
.
modify
do
factory
:protected_tag
do
transient
do
authorize_user_to_create
nil
authorize_group_to_create
nil
end
trait
:developers_can_create
do
transient
do
default_access_level
false
end
after
(
:build
)
do
|
protected_tag
|
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
DEVELOPER
)
end
end
trait
:no_one_can_create
do
transient
do
default_access_level
false
end
after
(
:build
)
do
|
protected_tag
|
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
NO_ACCESS
)
end
end
trait
:maintainers_can_create
do
transient
do
default_access_level
false
end
after
(
:build
)
do
|
protected_tag
|
protected_tag
.
create_access_levels
.
new
(
access_level:
Gitlab
::
Access
::
MAINTAINER
)
end
end
after
(
:build
)
do
|
protected_tag
,
evaluator
|
if
evaluator
.
authorize_user_to_create
protected_tag
.
create_access_levels
.
new
(
user:
evaluator
.
authorize_user_to_create
)
end
if
evaluator
.
authorize_group_to_create
protected_tag
.
create_access_levels
.
new
(
group:
evaluator
.
authorize_group_to_create
)
end
end
end
end
spec/factories/protected_tags.rb
View file @
58171a67
...
...
@@ -4,10 +4,6 @@ FactoryBot.define do
project
transient
do
# EE
authorize_user_to_create
nil
authorize_group_to_create
nil
default_access_level
true
end
...
...
@@ -42,15 +38,6 @@ FactoryBot.define do
end
after
(
:build
)
do
|
protected_tag
,
evaluator
|
# EE
if
evaluator
.
authorize_user_to_create
protected_tag
.
create_access_levels
.
new
(
user:
evaluator
.
authorize_user_to_create
)
end
if
evaluator
.
authorize_group_to_create
protected_tag
.
create_access_levels
.
new
(
group:
evaluator
.
authorize_group_to_create
)
end
if
evaluator
.
default_access_level
protected_tag
.
create_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