Commit b550582c authored by Sean McGivern's avatar Sean McGivern

Merge branch 'mc/feature/allow-admins-to-delete-builds' into 'master'

Add specs for instance admins erasing builds

See merge request gitlab-org/gitlab!38164
parents 109a57ca 0f4241b5
......@@ -247,6 +247,36 @@ RSpec.describe Ci::BuildPolicy do
it { expect(policy).to be_disallowed :erase_build }
end
end
context 'when an admin erases a build', :enable_admin_mode do
let(:owner) { create(:user) }
before do
user.update!(admin: true)
end
context 'when the build was created for a protected branch' do
before do
create(:protected_branch, :developers_can_push,
name: build.ref, project: project)
end
it { expect(policy).to be_allowed :erase_build }
end
context 'when the build was created for a protected tag' do
before do
create(:protected_tag, :developers_can_create,
name: build.ref, project: project)
end
it { expect(policy).to be_allowed :erase_build }
end
context 'when the build was created for an unprotected ref' do
it { expect(policy).to be_allowed :erase_build }
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment