Record user that erased a build through API

This commit is contained in:
Grzegorz Bizon 2016-02-16 13:06:52 +01:00
parent fb62196f43
commit 73c9d80bdc
2 changed files with 6 additions and 1 deletions

View file

@ -138,7 +138,7 @@ module API
return not_found!(build) unless build return not_found!(build) unless build
return forbidden!('Build is not erasable!') unless build.erasable? return forbidden!('Build is not erasable!') unless build.erasable?
build.erase build.erase(erased_by: current_user)
present build, with: Entities::Build, present build, with: Entities::Build,
user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project) user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project)
end end

View file

@ -184,6 +184,11 @@ describe API::API, api: true do
expect(build.artifacts_file.exists?).to be_falsy expect(build.artifacts_file.exists?).to be_falsy
expect(build.artifacts_metadata.exists?).to be_falsy expect(build.artifacts_metadata.exists?).to be_falsy
end end
it 'should update build' do
expect(build.reload.erased_at).to be_truthy
expect(build.reload.erased_by).to eq user
end
end end
context 'build is not erasable' do context 'build is not erasable' do