diff options
Diffstat (limited to 'spec/services/ci/job_artifacts')
-rw-r--r-- | spec/services/ci/job_artifacts/create_service_spec.rb | 8 | ||||
-rw-r--r-- | spec/services/ci/job_artifacts/destroy_batch_service_spec.rb | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/spec/services/ci/job_artifacts/create_service_spec.rb b/spec/services/ci/job_artifacts/create_service_spec.rb index b7a810ce47e..7b3f67b192f 100644 --- a/spec/services/ci/job_artifacts/create_service_spec.rb +++ b/spec/services/ci/job_artifacts/create_service_spec.rb @@ -34,6 +34,14 @@ RSpec.describe Ci::JobArtifacts::CreateService do subject { service.execute(artifacts_file, params, metadata_file: metadata_file) } context 'when artifacts file is uploaded' do + it 'logs the created artifact' do + expect(Gitlab::Ci::Artifacts::Logger) + .to receive(:log_created) + .with(an_instance_of(Ci::JobArtifact)) + + subject + end + it 'returns artifact in the response' do response = subject new_artifact = job.job_artifacts.last diff --git a/spec/services/ci/job_artifacts/destroy_batch_service_spec.rb b/spec/services/ci/job_artifacts/destroy_batch_service_spec.rb index 05069054483..9ca39d4d32e 100644 --- a/spec/services/ci/job_artifacts/destroy_batch_service_spec.rb +++ b/spec/services/ci/job_artifacts/destroy_batch_service_spec.rb @@ -40,7 +40,14 @@ RSpec.describe Ci::JobArtifacts::DestroyBatchService do expect { execute }.not_to change { artifact_with_file.file.exists? } end - it 'deletes the artifact records' do + it 'deletes the artifact records and logs them' do + expect(Gitlab::Ci::Artifacts::Logger) + .to receive(:log_deleted) + .with( + match_array([artifact_with_file, artifact_without_file]), + 'Ci::JobArtifacts::DestroyBatchService#execute' + ) + expect { subject }.to change { Ci::JobArtifact.count }.by(-2) end |