diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-10 18:11:27 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-06-13 13:07:23 +0300 |
commit | 6013768fec33e3bf084019d97dbfb7cca78f8e82 (patch) | |
tree | 6d79ea67c7ea8bdae03f0cdfd958b6586b817dd6 /spec/requests | |
parent | 7e9273dd946f46b2b2bcc0a751316dc704089a16 (diff) |
Added keep artifacts API endpoint
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/builds_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb index 6cb7be188ef..b92d991b998 100644 --- a/spec/requests/api/builds_spec.rb +++ b/spec/requests/api/builds_spec.rb @@ -241,4 +241,31 @@ describe API::API, api: true do end end end + + describe 'POST /projects/:id/builds/:build_id/artifacts/keep' do + before do + post api("/projects/#{project.id}/builds/#{build.id}/artifacts/keep", user) + end + + context 'artifacts did not expire' do + let(:build) do + create(:ci_build, :trace, :artifacts, :success, + project: project, pipeline: pipeline, artifacts_expire_at: Time.now + 7.days) + end + + it 'should keep artifacts' do + expect(response.status).to eq 200 + build.reload + expect(build.artifacts_expire_at).to be_nil + end + end + + context 'no artifacts' do + let(:build) { create(:ci_build, project: project, pipeline: pipeline) } + + it 'should respond with not found' do + expect(response.status).to eq 404 + end + end + end end |