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
8029c92e
Commit
8029c92e
authored
Nov 07, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce changes
parent
d8fb903e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
30 deletions
+25
-30
spec/controllers/projects/jobs_controller_spec.rb
spec/controllers/projects/jobs_controller_spec.rb
+2
-2
spec/requests/api/jobs_spec.rb
spec/requests/api/jobs_spec.rb
+23
-28
No files found.
spec/controllers/projects/jobs_controller_spec.rb
View file @
8029c92e
...
...
@@ -371,6 +371,8 @@ describe Projects::JobsController do
end
describe
'POST erase'
do
let
(
:role
)
{
:master
}
before
do
project
.
team
<<
[
user
,
role
]
sign_in
(
user
)
...
...
@@ -378,8 +380,6 @@ describe Projects::JobsController do
post_erase
end
let
(
:role
)
{
:master
}
context
'when job is erasable'
do
let
(
:job
)
{
create
(
:ci_build
,
:erasable
,
:trace
,
pipeline:
pipeline
)
}
...
...
spec/requests/api/jobs_spec.rb
View file @
8029c92e
...
...
@@ -500,47 +500,42 @@ describe API::Jobs do
end
describe
'POST /projects/:id/jobs/:job_id/erase'
do
context
'when a master erases a build'
do
before
do
project
.
add_master
(
user
)
post
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/erase"
,
user
)
end
let
(
:role
)
{
:master
}
context
'job is erasable'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
)
}
before
do
project
.
team
<<
[
user
,
role
]
it
'erases job content'
do
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
job
).
not_to
have_trace
expect
(
job
.
artifacts_file
.
exists?
).
to
be_falsy
expect
(
job
.
artifacts_metadata
.
exists?
).
to
be_falsy
end
post
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/erase"
,
user
)
end
it
'updates job
'
do
job
.
reload
context
'job is erasable
'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
)
}
expect
(
job
.
erased_at
).
to
be_truthy
expect
(
job
.
erased_by
).
to
eq
(
user
)
end
it
'erases job content'
do
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
job
).
not_to
have_trace
expect
(
job
.
artifacts_file
.
exists?
).
to
be_falsy
expect
(
job
.
artifacts_metadata
.
exists?
).
to
be_falsy
end
context
'job is not erasable
'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
project:
project
,
pipeline:
pipeline
)
}
it
'updates job
'
do
job
.
reload
it
'responds with forbidden'
do
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
expect
(
job
.
erased_at
).
to
be_truthy
expect
(
job
.
erased_by
).
to
eq
(
user
)
end
end
context
'when a developer erases a build'
do
before
do
project
.
add_developer
(
user
)
context
'job is not erasable'
do
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
project:
project
,
pipeline:
pipeline
)
}
post
api
(
"/projects/
#{
project
.
id
}
/jobs/
#{
job
.
id
}
/erase"
,
user
)
it
'responds with forbidden'
do
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
context
'when a developer erases a build'
do
let
(
:role
)
{
:developer
}
let
(
:job
)
{
create
(
:ci_build
,
:trace
,
:artifacts
,
:success
,
project:
project
,
pipeline:
pipeline
,
user:
owner
)
}
context
'when the build was created by the developer'
do
...
...
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