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
05683f31
Commit
05683f31
authored
Jun 12, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix filename method of GitlabUploader to return always real filename
parent
652eb011
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
2 deletions
+43
-2
app/uploaders/gitlab_uploader.rb
app/uploaders/gitlab_uploader.rb
+4
-0
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+23
-2
spec/uploaders/artifact_uploader_spec.rb
spec/uploaders/artifact_uploader_spec.rb
+16
-0
No files found.
app/uploaders/gitlab_uploader.rb
View file @
05683f31
...
@@ -61,6 +61,10 @@ class GitlabUploader < CarrierWave::Uploader::Base
...
@@ -61,6 +61,10 @@ class GitlabUploader < CarrierWave::Uploader::Base
CarrierWave
.
tmp_path
CarrierWave
.
tmp_path
end
end
def
filename
super
||
file
&
.
filename
end
private
private
# To prevent files from moving across filesystems, override the default
# To prevent files from moving across filesystems, override the default
...
...
spec/requests/api/runner_spec.rb
View file @
05683f31
...
@@ -431,8 +431,29 @@ describe API::Runner do
...
@@ -431,8 +431,29 @@ describe API::Runner do
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'id'
]).
to
eq
(
test_job
.
id
)
expect
(
json_response
[
'id'
]).
to
eq
(
test_job
.
id
)
expect
(
json_response
[
'dependencies'
].
count
).
to
eq
(
2
)
expect
(
json_response
[
'dependencies'
].
count
).
to
eq
(
2
)
expect
(
json_response
[
'dependencies'
]).
to
include
({
'id'
=>
job
.
id
,
'name'
=>
job
.
name
,
'token'
=>
job
.
token
},
expect
(
json_response
[
'dependencies'
]).
to
include
(
{
'id'
=>
job2
.
id
,
'name'
=>
job2
.
name
,
'token'
=>
job2
.
token
})
{
'id'
=>
job
.
id
,
'name'
=>
job
.
name
,
'token'
=>
job
.
token
},
{
'id'
=>
job2
.
id
,
'name'
=>
job2
.
name
,
'token'
=>
job2
.
token
})
end
end
context
'when pipeline have jobs with artifacts'
do
let!
(
:job
)
{
create
(
:ci_build_tag
,
:artifacts
,
pipeline:
pipeline
,
name:
'spinach'
,
stage:
'test'
,
stage_idx:
0
)
}
let!
(
:test_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
name:
'deploy'
,
stage:
'deploy'
,
stage_idx:
1
)
}
before
do
job
.
success
end
it
'returns dependent jobs'
do
request_job
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'id'
]).
to
eq
(
test_job
.
id
)
expect
(
json_response
[
'dependencies'
].
count
).
to
eq
(
1
)
expect
(
json_response
[
'dependencies'
]).
to
include
(
{
'id'
=>
job
.
id
,
'name'
=>
job
.
name
,
'token'
=>
job
.
token
,
'artifacts_file'
=>
{
'filename'
=>
'ci_build_artifacts.zip'
,
'size'
=>
106365
}
})
end
end
end
end
...
...
spec/uploaders/artifact_uploader_spec.rb
View file @
05683f31
...
@@ -42,4 +42,20 @@ describe ArtifactUploader do
...
@@ -42,4 +42,20 @@ describe ArtifactUploader do
it
{
is_expected
.
to
start_with
(
path
)
}
it
{
is_expected
.
to
start_with
(
path
)
}
it
{
is_expected
.
to
end_with
(
'/tmp/work'
)
}
it
{
is_expected
.
to
end_with
(
'/tmp/work'
)
}
end
end
describe
'#filename'
do
# we need to use uploader, as this makes to use mounter
# which initialises uploader.file object
let
(
:uploader
)
{
job
.
artifacts_file
}
subject
{
uploader
.
filename
}
it
{
is_expected
.
to
be_nil
}
context
'with artifacts'
do
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
)
}
it
{
is_expected
.
not_to
be_nil
}
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