summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-07-09 18:13:34 +0200
committerKamil Trzciński <ayufan@ayufan.eu>2018-07-09 18:13:34 +0200
commit737666a3d121b1bf89861de4445f857256a47949 (patch)
treedae905ec23c56a1724a6df529091769f48b30dca
parent5a9f23e780222218cc8418fd859669befcaed1b2 (diff)
downloadgitlab-ce-737666a3d121b1bf89861de4445f857256a47949.tar.gz
Fix specs
-rw-r--r--app/uploaders/gitlab_uploader.rb11
-rw-r--r--spec/controllers/projects/jobs_controller_spec.rb11
-rw-r--r--spec/requests/api/jobs_spec.rb4
3 files changed, 13 insertions, 13 deletions
diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb
index 7aa81a8c312..719bd6ef418 100644
--- a/app/uploaders/gitlab_uploader.rb
+++ b/app/uploaders/gitlab_uploader.rb
@@ -76,11 +76,12 @@ class GitlabUploader < CarrierWave::Uploader::Base
end
def open
- stream = if file_storage?
- File.open(path, "rb") if path
- else
- ::Gitlab::HttpIO.new(url, cached_size) if url
- end
+ stream =
+ if file_storage?
+ File.open(path, "rb") if path
+ else
+ ::Gitlab::HttpIO.new(url, cached_size) if url
+ end
return unless stream
return stream unless block_given?
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb
index 38431fb1598..6be27126383 100644
--- a/spec/controllers/projects/jobs_controller_spec.rb
+++ b/spec/controllers/projects/jobs_controller_spec.rb
@@ -216,20 +216,19 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
context 'when trace artifact is in ObjectStorage' do
+ let(:url) { 'http://object-storage/trace' }
+ let(:file_path) { expand_fixture_path('trace/sample_trace') }
let!(:job) { create(:ci_build, :success, :trace_artifact, pipeline: pipeline) }
before do
allow_any_instance_of(JobArtifactUploader).to receive(:file_storage?) { false }
- allow_any_instance_of(JobArtifactUploader).to receive(:url) { remote_trace_url }
- allow_any_instance_of(JobArtifactUploader).to receive(:size) { remote_trace_size }
+ allow_any_instance_of(JobArtifactUploader).to receive(:url) { url }
+ allow_any_instance_of(JobArtifactUploader).to receive(:size) { File.size(file_path) }
end
context 'when there are no network issues' do
- let(:url) { 'http://object-storage/trace' }
- let(:file) { expand_fixture_path('trace/sample_trace') }
-
before do
- stub_remote_url_206(url, file)
+ stub_remote_url_206(url, file_path)
get_trace
end
diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb
index 8a2812d1576..0609166ed90 100644
--- a/spec/requests/api/jobs_spec.rb
+++ b/spec/requests/api/jobs_spec.rb
@@ -536,13 +536,13 @@ describe API::Jobs do
context 'when trace is in ObjectStorage' do
let!(:job) { create(:ci_build, :trace_artifact, pipeline: pipeline) }
let(:url) { 'http://object-storage/trace' }
- let(:file) { expand_fixture_path('trace/sample_trace') }
+ let(:file_path) { expand_fixture_path('trace/sample_trace') }
before do
stub_remote_url_206(url, file_path)
allow_any_instance_of(JobArtifactUploader).to receive(:file_storage?) { false }
allow_any_instance_of(JobArtifactUploader).to receive(:url) { url }
- allow_any_instance_of(JobArtifactUploader).to receive(:size) { File.size(file) }
+ allow_any_instance_of(JobArtifactUploader).to receive(:size) { File.size(file_path) }
end
it 'returns specific job trace' do