diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-12 15:10:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-12 15:10:33 +0000 |
commit | 8ff63012e9b7e3dc2279e636868af9a438d1fa93 (patch) | |
tree | 4dd67f247345cbc2e8629c4a5f2b935dafc988e3 /spec/policies | |
parent | ef7cfec30c9fab7b9e757877c472ca7ca2eccc2d (diff) | |
download | gitlab-ce-8ff63012e9b7e3dc2279e636868af9a438d1fa93.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-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 |