diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-16 13:06:52 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-19 17:24:59 +0100 |
commit | 73c9d80bdcc24ab178fa2a38eb822232b4c2be34 (patch) | |
tree | fb25c6a001f16912809f3e62a2c68811586de675 | |
parent | fb62196f430a12e93ab3cf70b3182df130fef6fe (diff) | |
download | gitlab-ce-73c9d80bdcc24ab178fa2a38eb822232b4c2be34.tar.gz |
Record user that erased a build through API
-rw-r--r-- | lib/api/builds.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/builds_spec.rb | 5 |
2 files changed, 6 insertions, 1 deletions
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 |