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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
719b0f11
Commit
719b0f11
authored
Jul 19, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make minimal changes to specs
parent
dc6afd57
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
56 deletions
+17
-56
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+17
-56
No files found.
spec/requests/api/builds_spec.rb
View file @
719b0f11
...
@@ -6,21 +6,16 @@ describe API::API, api: true do
...
@@ -6,21 +6,16 @@ describe API::API, api: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:api_user
)
{
user
}
let
(
:api_user
)
{
user
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
let
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user
,
project:
project
)
}
let
!
(
:developer
)
{
create
(
:project_member
,
:developer
,
user:
user
,
project:
project
)
}
let
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
user:
user2
,
project:
project
)
}
let
!
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
user:
user2
,
project:
project
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
}
let
!
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
,
ref:
project
.
default_branch
)
}
let
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
let
!
(
:build
)
{
create
(
:ci_build
,
pipeline:
pipeline
)
}
describe
'GET /projects/:id/builds '
do
describe
'GET /projects/:id/builds '
do
let
(
:query
)
{
''
}
let
(
:query
)
{
''
}
before
do
before
{
get
api
(
"/projects/
#{
project
.
id
}
/builds?
#{
query
}
"
,
api_user
)
}
developer
build
get
api
(
"/projects/
#{
project
.
id
}
/builds?
#{
query
}
"
,
api_user
)
end
context
'authorized user'
do
context
'authorized user'
do
it
'should return project builds'
do
it
'should return project builds'
do
...
@@ -82,9 +77,9 @@ describe API::API, api: true do
...
@@ -82,9 +77,9 @@ describe API::API, api: true do
context
'when user is authorized'
do
context
'when user is authorized'
do
context
'when pipeline has builds'
do
context
'when pipeline has builds'
do
before
do
before
do
developer
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
build
create
(
:ci_build
,
pipeline:
pipeline
)
create
(
:ci_build
,
pipeline:
pipeline
)
create
(
:ci_build
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
commit
.
id
}
/builds"
,
api_user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
commit
.
id
}
/builds"
,
api_user
)
end
end
...
@@ -98,8 +93,6 @@ describe API::API, api: true do
...
@@ -98,8 +93,6 @@ describe API::API, api: true do
context
'when pipeline has no builds'
do
context
'when pipeline has no builds'
do
before
do
before
do
developer
branch_head
=
project
.
commit
(
'feature'
).
id
branch_head
=
project
.
commit
(
'feature'
).
id
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
branch_head
}
/builds"
,
api_user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
branch_head
}
/builds"
,
api_user
)
end
end
...
@@ -114,7 +107,8 @@ describe API::API, api: true do
...
@@ -114,7 +107,8 @@ describe API::API, api: true do
context
'when user is not authorized'
do
context
'when user is not authorized'
do
before
do
before
do
build
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
id
)
create
(
:ci_build
,
pipeline:
pipeline
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
commit
.
id
}
/builds"
,
nil
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
commit
.
id
}
/builds"
,
nil
)
end
end
...
@@ -128,11 +122,7 @@ describe API::API, api: true do
...
@@ -128,11 +122,7 @@ describe API::API, api: true do
end
end
describe
'GET /projects/:id/builds/:build_id'
do
describe
'GET /projects/:id/builds/:build_id'
do
before
do
before
{
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
"
,
api_user
)
}
developer
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
"
,
api_user
)
end
context
'authorized user'
do
context
'authorized user'
do
it
'should return specific build data'
do
it
'should return specific build data'
do
...
@@ -151,11 +141,7 @@ describe API::API, api: true do
...
@@ -151,11 +141,7 @@ describe API::API, api: true do
end
end
describe
'GET /projects/:id/builds/:build_id/artifacts'
do
describe
'GET /projects/:id/builds/:build_id/artifacts'
do
before
do
before
{
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/artifacts"
,
api_user
)
}
developer
get
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/artifacts"
,
api_user
)
end
context
'build with artifacts'
do
context
'build with artifacts'
do
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
...
@@ -187,26 +173,15 @@ describe API::API, api: true do
...
@@ -187,26 +173,15 @@ describe API::API, api: true do
end
end
describe
'GET /projects/:id/artifacts/:ref_name/download?job=name'
do
describe
'GET /projects/:id/artifacts/:ref_name/download?job=name'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:api_user
)
{
user2
}
# is a reporter of the project
let
(
:project
)
{
create
(
:project
)
}
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
project
.
default_branch
)
end
let
(
:build
)
{
create
(
:ci_build
,
:success
,
:artifacts
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
:success
,
:artifacts
,
pipeline:
pipeline
)
}
before
do
project
.
team
<<
[
user
,
:developer
]
end
def
path_for_ref
(
ref
=
pipeline
.
ref
,
job
=
build
.
name
)
def
path_for_ref
(
ref
=
pipeline
.
ref
,
job
=
build
.
name
)
api
(
"/projects/
#{
project
.
id
}
/builds/artifacts/
#{
ref
}
/download?job=
#{
job
}
"
,
user
)
api
(
"/projects/
#{
project
.
id
}
/builds/artifacts/
#{
ref
}
/download?job=
#{
job
}
"
,
api_
user
)
end
end
context
'when unauthorized'
do
context
'when unauthorized'
do
let
(
:user
)
{
nil
}
let
(
:
api_
user
)
{
nil
}
before
do
before
do
get
path_for_ref
get
path_for_ref
...
@@ -334,12 +309,7 @@ describe API::API, api: true do
...
@@ -334,12 +309,7 @@ describe API::API, api: true do
end
end
describe
'POST /projects/:id/builds/:build_id/cancel'
do
describe
'POST /projects/:id/builds/:build_id/cancel'
do
before
do
before
{
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/cancel"
,
api_user
)
}
developer
reporter
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/cancel"
,
api_user
)
end
context
'authorized user'
do
context
'authorized user'
do
context
'user with :update_build persmission'
do
context
'user with :update_build persmission'
do
...
@@ -370,12 +340,7 @@ describe API::API, api: true do
...
@@ -370,12 +340,7 @@ describe API::API, api: true do
describe
'POST /projects/:id/builds/:build_id/retry'
do
describe
'POST /projects/:id/builds/:build_id/retry'
do
let
(
:build
)
{
create
(
:ci_build
,
:canceled
,
pipeline:
pipeline
)
}
let
(
:build
)
{
create
(
:ci_build
,
:canceled
,
pipeline:
pipeline
)
}
before
do
before
{
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/retry"
,
api_user
)
}
developer
reporter
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/retry"
,
api_user
)
end
context
'authorized user'
do
context
'authorized user'
do
context
'user with :update_build permission'
do
context
'user with :update_build permission'
do
...
@@ -406,8 +371,6 @@ describe API::API, api: true do
...
@@ -406,8 +371,6 @@ describe API::API, api: true do
describe
'POST /projects/:id/builds/:build_id/erase'
do
describe
'POST /projects/:id/builds/:build_id/erase'
do
before
do
before
do
developer
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/erase"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/erase"
,
user
)
end
end
...
@@ -438,8 +401,6 @@ describe API::API, api: true do
...
@@ -438,8 +401,6 @@ describe API::API, api: true do
describe
'POST /projects/:id/builds/:build_id/artifacts/keep'
do
describe
'POST /projects/:id/builds/:build_id/artifacts/keep'
do
before
do
before
do
developer
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/artifacts/keep"
,
user
)
post
api
(
"/projects/
#{
project
.
id
}
/builds/
#{
build
.
id
}
/artifacts/keep"
,
user
)
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