diff options
Diffstat (limited to 'spec/services/ci/create_job_artifacts_service_spec.rb')
-rw-r--r-- | spec/services/ci/create_job_artifacts_service_spec.rb | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/spec/services/ci/create_job_artifacts_service_spec.rb b/spec/services/ci/create_job_artifacts_service_spec.rb index 4d49923a184..3f5cf079025 100644 --- a/spec/services/ci/create_job_artifacts_service_spec.rb +++ b/spec/services/ci/create_job_artifacts_service_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -describe Ci::CreateJobArtifactsService do +RSpec.describe Ci::CreateJobArtifactsService do let_it_be(:project) { create(:project) } - let(:service) { described_class.new(project) } + let(:service) { described_class.new(job) } let(:job) { create(:ci_build, project: project) } let(:artifacts_sha256) { '0' * 64 } let(:metadata_file) { nil } @@ -17,7 +17,7 @@ describe Ci::CreateJobArtifactsService do { 'artifact_type' => 'archive', 'artifact_format' => 'zip' - } + }.with_indifferent_access end def file_to_upload(path, params = {}) @@ -28,27 +28,7 @@ describe Ci::CreateJobArtifactsService do end describe '#execute' do - subject { service.execute(job, artifacts_file, params, metadata_file: metadata_file) } - - context 'locking' do - let(:old_job) { create(:ci_build, pipeline: create(:ci_pipeline, project: job.project, ref: job.ref)) } - let!(:latest_artifact) { create(:ci_job_artifact, job: old_job, locked: true) } - let!(:other_artifact) { create(:ci_job_artifact, locked: true) } - - it 'locks the new artifact' do - subject - - expect(Ci::JobArtifact.last).to have_attributes(locked: true) - end - - it 'unlocks all other artifacts for the same ref' do - expect { subject }.to change { latest_artifact.reload.locked }.from(true).to(false) - end - - it 'does not unlock artifacts for other refs' do - expect { subject }.not_to change { other_artifact.reload.locked }.from(true) - end - end + subject { service.execute(artifacts_file, params, metadata_file: metadata_file) } context 'when artifacts file is uploaded' do it 'saves artifact for the given type' do @@ -150,7 +130,7 @@ describe Ci::CreateJobArtifactsService do { 'artifact_type' => 'dotenv', 'artifact_format' => 'gzip' - } + }.with_indifferent_access end it 'calls parse service' do @@ -186,7 +166,7 @@ describe Ci::CreateJobArtifactsService do { 'artifact_type' => 'cluster_applications', 'artifact_format' => 'gzip' - } + }.with_indifferent_access end it 'calls cluster applications parse service' do |