From 73c9d80bdcc24ab178fa2a38eb822232b4c2be34 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 16 Feb 2016 13:06:52 +0100 Subject: [PATCH] Record user that erased a build through API --- lib/api/builds.rb | 2 +- spec/requests/api/builds_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/api/builds.rb b/lib/api/builds.rb index b265fa148ba..c058128ae54 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -138,7 +138,7 @@ module API return not_found!(build) unless build return forbidden!('Build is not erasable!') unless build.erasable? - build.erase + build.erase(erased_by: current_user) present build, with: Entities::Build, user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project) end diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb index c634bb84b77..adbae5dcad8 100644 --- a/spec/requests/api/builds_spec.rb +++ b/spec/requests/api/builds_spec.rb @@ -184,6 +184,11 @@ describe API::API, api: true do expect(build.artifacts_file.exists?).to be_falsy expect(build.artifacts_metadata.exists?).to be_falsy end + + it 'should update build' do + expect(build.reload.erased_at).to be_truthy + expect(build.reload.erased_by).to eq user + end end context 'build is not erasable' do