Commit 0f4241b5 authored by Matija Čupić's avatar Matija Čupić

Add specs for when admin erases a build

parent f7272b77
......@@ -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