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
0f4241b5
Commit
0f4241b5
authored
Jul 29, 2020
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for when admin erases a build
parent
f7272b77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
spec/policies/ci/build_policy_spec.rb
spec/policies/ci/build_policy_spec.rb
+30
-0
No files found.
spec/policies/ci/build_policy_spec.rb
View file @
0f4241b5
...
...
@@ -247,6 +247,36 @@ RSpec.describe Ci::BuildPolicy do
it
{
expect
(
policy
).
to
be_disallowed
:erase_build
}
end
end
context
'when an admin erases a build'
,
:enable_admin_mode
do
let
(
:owner
)
{
create
(
:user
)
}
before
do
user
.
update!
(
admin:
true
)
end
context
'when the build was created for a protected branch'
do
before
do
create
(
:protected_branch
,
:developers_can_push
,
name:
build
.
ref
,
project:
project
)
end
it
{
expect
(
policy
).
to
be_allowed
:erase_build
}
end
context
'when the build was created for a protected tag'
do
before
do
create
(
:protected_tag
,
:developers_can_create
,
name:
build
.
ref
,
project:
project
)
end
it
{
expect
(
policy
).
to
be_allowed
:erase_build
}
end
context
'when the build was created for an unprotected ref'
do
it
{
expect
(
policy
).
to
be_allowed
:erase_build
}
end
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