diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-02-14 19:34:07 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-02-15 15:31:51 +0800 |
commit | ac872078486145f43e8a42dbd60ed47be70a301f (patch) | |
tree | 4d83594067b97e9a792ad809d3b21962bece6fc0 /spec/requests/ci | |
parent | 3e158beca4f9e7e7887d7301e1ea97bef7eade84 (diff) | |
download | gitlab-ce-ac872078486145f43e8a42dbd60ed47be70a301f.tar.gz |
Test build API if expire_in not set, set to app default
Diffstat (limited to 'spec/requests/ci')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index 44f69bff30d..0f2c6f2dc69 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -630,6 +630,7 @@ describe Ci::API::Builds do context 'with an expire date' do let!(:artifacts) { file_upload } + let(:default_artifacts_expiration) { 0 } let(:post_data) do { 'file.path' => artifacts.path, @@ -638,7 +639,8 @@ describe Ci::API::Builds do end before do - stub_application_setting(default_artifacts_expiration: 0) + stub_application_setting( + default_artifacts_expiration: default_artifacts_expiration) post(post_url, post_data, headers_with_token) end @@ -650,7 +652,8 @@ describe Ci::API::Builds do build.reload expect(response).to have_http_status(201) expect(json_response['artifacts_expire_at']).not_to be_empty - expect(build.artifacts_expire_at).to be_within(5.minutes).of(Time.now + 7.days) + expect(build.artifacts_expire_at). + to be_within(5.minutes).of(7.days.from_now) end end @@ -663,6 +666,18 @@ describe Ci::API::Builds do expect(json_response['artifacts_expire_at']).to be_nil expect(build.artifacts_expire_at).to be_nil end + + context 'with application default' do + let(:default_artifacts_expiration) { 5 } + + it 'sets to application default' do + build.reload + expect(response).to have_http_status(201) + expect(json_response['artifacts_expire_at']).not_to be_empty + expect(build.artifacts_expire_at). + to be_within(5.minutes).of(5.days.from_now) + end + end end end |