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
Boxiang Sun
gitlab-ce
Commits
398de9f1
Commit
398de9f1
authored
Jul 15, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now we're able to merge the spec
parent
640fc826
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
48 deletions
+43
-48
spec/requests/api/artifacts_spec.rb
spec/requests/api/artifacts_spec.rb
+0
-48
spec/requests/api/builds_spec.rb
spec/requests/api/builds_spec.rb
+43
-0
No files found.
spec/requests/api/artifacts_spec.rb
deleted
100644 → 0
View file @
640fc826
require
'spec_helper'
require_relative
'../shared/artifacts_context'
describe
API
::
API
,
api:
true
do
include
ApiHelpers
describe
'GET /projects/:id/artifacts/:ref_name/:build_name'
do
include_context
'artifacts from ref and build name'
def
path_from_ref
(
ref
=
pipeline
.
sha
,
job
=
build
.
name
)
api
(
"/projects/
#{
project
.
id
}
/builds/artifacts/
#{
ref
}
?job=
#{
job
}
"
,
user
)
end
context
'401'
do
let
(
:user
)
{
nil
}
before
do
get
path_from_ref
end
it
'gives 401 for unauthorized user'
do
expect
(
response
).
to
have_http_status
(
401
)
end
end
context
'404'
do
def
verify
expect
(
response
).
to
have_http_status
(
404
)
end
it_behaves_like
'artifacts from ref with 404'
end
context
'200'
do
def
verify
download_headers
=
{
'Content-Transfer-Encoding'
=>
'binary'
,
'Content-Disposition'
=>
"attachment; filename=
#{
build
.
artifacts_file
.
filename
}
"
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
).
to
include
(
download_headers
)
end
it_behaves_like
'artifacts from ref with 302'
end
end
end
spec/requests/api/builds_spec.rb
View file @
398de9f1
require
'spec_helper'
require_relative
'../shared/artifacts_context'
describe
API
::
API
,
api:
true
do
include
ApiHelpers
...
...
@@ -186,6 +187,48 @@ describe API::API, api: true do
end
end
describe
'GET /projects/:id/artifacts/:ref_name/:build_name'
do
include_context
'artifacts from ref and build name'
def
path_from_ref
(
ref
=
pipeline
.
sha
,
job
=
build
.
name
)
api
(
"/projects/
#{
project
.
id
}
/builds/artifacts/
#{
ref
}
?job=
#{
job
}
"
,
user
)
end
context
'401'
do
let
(
:user
)
{
nil
}
before
do
get
path_from_ref
end
it
'gives 401 for unauthorized user'
do
expect
(
response
).
to
have_http_status
(
401
)
end
end
context
'404'
do
def
verify
expect
(
response
).
to
have_http_status
(
404
)
end
it_behaves_like
'artifacts from ref with 404'
end
context
'200'
do
def
verify
download_headers
=
{
'Content-Transfer-Encoding'
=>
'binary'
,
'Content-Disposition'
=>
"attachment; filename=
#{
build
.
artifacts_file
.
filename
}
"
}
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
.
headers
).
to
include
(
download_headers
)
end
it_behaves_like
'artifacts from ref with 302'
end
end
describe
'GET /projects/:id/builds/:build_id/trace'
do
let
(
:build
)
{
create
(
:ci_build
,
:trace
,
pipeline:
pipeline
)
}
...
...
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