diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/policies/ci | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/policies/ci')
-rw-r--r-- | spec/policies/ci/build_policy_spec.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/spec/policies/ci/build_policy_spec.rb b/spec/policies/ci/build_policy_spec.rb index 333f4e560cf..f29ed26f2aa 100644 --- a/spec/policies/ci/build_policy_spec.rb +++ b/spec/policies/ci/build_policy_spec.rb @@ -176,15 +176,21 @@ describe Ci::BuildPolicy do end context 'when developers can push to the branch' do - before do - create(:protected_branch, :developers_can_push, - name: build.ref, project: project) - end - context 'when the build was created by the developer' do let(:owner) { user } - it { expect(policy).to be_allowed :erase_build } + context 'when the build was created for a protected ref' do + before do + create(:protected_branch, :developers_can_push, + name: build.ref, project: project) + end + + it { expect(policy).to be_disallowed :erase_build } + end + + context 'when the build was created for an unprotected ref' do + it { expect(policy).to be_allowed :erase_build } + end end context 'when the build was created by the other' do |