From 1670a9fe98dc636cdf455f4177d359934b83b073 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Sat, 24 Feb 2018 00:02:13 +0900 Subject: [PATCH] Fixed static analysys --- app/services/ci/create_trace_artifact_service.rb | 2 +- spec/services/ci/create_trace_artifact_service_spec.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/services/ci/create_trace_artifact_service.rb b/app/services/ci/create_trace_artifact_service.rb index 00151f4bd1c..baa33de2857 100644 --- a/app/services/ci/create_trace_artifact_service.rb +++ b/app/services/ci/create_trace_artifact_service.rb @@ -4,7 +4,7 @@ module Ci return if job.job_artifacts_trace job.trace.read do |stream| - return unless stream.file? + return unless stream.file? # rubocop:disable Lint/NonLocalExitFromIterator temp_file!(stream.path, JobArtifactUploader.workhorse_upload_path) do |temp_path| job.create_job_artifacts_trace!( diff --git a/spec/services/ci/create_trace_artifact_service_spec.rb b/spec/services/ci/create_trace_artifact_service_spec.rb index f928deb8632..dc22165c9e2 100644 --- a/spec/services/ci/create_trace_artifact_service_spec.rb +++ b/spec/services/ci/create_trace_artifact_service_spec.rb @@ -12,13 +12,13 @@ describe Ci::CreateTraceArtifactService do let(:new_path) { job.job_artifacts_trace.file.path } let(:new_checksum) { Digest::SHA256.file(new_path).hexdigest } - it { expect(File.exists?(legacy_path)).to be_truthy } + it { expect(File.exist?(legacy_path)).to be_truthy } it 'creates trace artifact' do expect { subject }.to change { Ci::JobArtifact.count }.by(1) - expect(File.exists?(legacy_path)).to be_falsy - expect(File.exists?(new_path)).to be_truthy + expect(File.exist?(legacy_path)).to be_falsy + expect(File.exist?(new_path)).to be_truthy expect(new_checksum).to eq(legacy_checksum) expect(job.job_artifacts_trace.file.exists?).to be_truthy expect(job.job_artifacts_trace.file.filename).to eq('job.log') @@ -37,7 +37,7 @@ describe Ci::CreateTraceArtifactService do end it 'keeps legacy trace and removes trace artifact' do - expect(File.exists?(legacy_path)).to be_truthy + expect(File.exist?(legacy_path)).to be_truthy expect(job.job_artifacts_trace).to be_nil end end @@ -50,7 +50,7 @@ describe Ci::CreateTraceArtifactService do it 'raises an error' do expect { subject }.to raise_error('Trace artifact not found') - expect(File.exists?(legacy_path)).to be_truthy + expect(File.exist?(legacy_path)).to be_truthy end end end -- GitLab