summaryrefslogtreecommitdiff
path: root/spec/services/ci/create_job_artifacts_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/ci/create_job_artifacts_service_spec.rb')
-rw-r--r--spec/services/ci/create_job_artifacts_service_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/services/ci/create_job_artifacts_service_spec.rb b/spec/services/ci/create_job_artifacts_service_spec.rb
index 3f5cf079025..72b0d220b11 100644
--- a/spec/services/ci/create_job_artifacts_service_spec.rb
+++ b/spec/services/ci/create_job_artifacts_service_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe Ci::CreateJobArtifactsService do
expect(metadata_artifact.expire_at).to be_within(1.minute).of(expected_expire_at)
end
- context 'when expire_in params is set' do
+ context 'when expire_in params is set to a specific value' do
before do
params.merge!('expire_in' => '2 hours')
end
@@ -89,6 +89,23 @@ RSpec.describe Ci::CreateJobArtifactsService do
expect(metadata_artifact.expire_at).to be_within(1.minute).of(expected_expire_at)
end
end
+
+ context 'when expire_in params is set to `never`' do
+ before do
+ params.merge!('expire_in' => 'never')
+ end
+
+ it 'sets expiration date according to the parameter' do
+ expected_expire_at = nil
+
+ expect(subject).to be_truthy
+ archive_artifact, metadata_artifact = job.job_artifacts.last(2)
+
+ expect(job.artifacts_expire_at).to eq(expected_expire_at)
+ expect(archive_artifact.expire_at).to eq(expected_expire_at)
+ expect(metadata_artifact.expire_at).to eq(expected_expire_at)
+ end
+ end
end
end