diff options
Diffstat (limited to 'spec/services/ci/job_artifacts')
-rw-r--r-- | spec/services/ci/job_artifacts/create_service_spec.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/spec/services/ci/job_artifacts/create_service_spec.rb b/spec/services/ci/job_artifacts/create_service_spec.rb index b8487e438a9..01f240805f5 100644 --- a/spec/services/ci/job_artifacts/create_service_spec.rb +++ b/spec/services/ci/job_artifacts/create_service_spec.rb @@ -42,6 +42,13 @@ RSpec.describe Ci::JobArtifacts::CreateService do subject { service.execute(artifacts_file, params, metadata_file: metadata_file) } context 'when artifacts file is uploaded' do + it 'returns artifact in the response' do + response = subject + new_artifact = job.job_artifacts.last + + expect(response[:artifact]).to eq(new_artifact) + end + it 'saves artifact for the given type' do expect { subject }.to change { Ci::JobArtifact.count }.by(1) @@ -84,7 +91,7 @@ RSpec.describe Ci::JobArtifacts::CreateService do it 'sets expiration date according to application settings' do expected_expire_at = 1.day.from_now - expect(subject).to match(a_hash_including(status: :success)) + expect(subject).to match(a_hash_including(status: :success, artifact: anything)) archive_artifact, metadata_artifact = job.job_artifacts.last(2) expect(job.artifacts_expire_at).to be_within(1.minute).of(expected_expire_at) @@ -100,7 +107,7 @@ RSpec.describe Ci::JobArtifacts::CreateService do it 'sets expiration date according to the parameter' do expected_expire_at = 2.hours.from_now - expect(subject).to match(a_hash_including(status: :success)) + expect(subject).to match(a_hash_including(status: :success, artifact: anything)) archive_artifact, metadata_artifact = job.job_artifacts.last(2) expect(job.artifacts_expire_at).to be_within(1.minute).of(expected_expire_at) |