summaryrefslogtreecommitdiff
path: root/spec/policies/ci
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-11-13 17:17:01 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-11-13 17:24:10 +0100
commit0bc14b452218277a55f71ab22bed724b696ecf28 (patch)
treee40bfff5efb59240cac45ac07906b3fccaf76291 /spec/policies/ci
parent6173d4639a388f59872291657a2528256c90a846 (diff)
downloadgitlab-ce-0bc14b452218277a55f71ab22bed724b696ecf28.tar.gz
Authorize DestroyPipelineService against pipeline
Diffstat (limited to 'spec/policies/ci')
-rw-r--r--spec/policies/ci/pipeline_policy_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/policies/ci/pipeline_policy_spec.rb b/spec/policies/ci/pipeline_policy_spec.rb
index bd32faf06ef..8022f61e67d 100644
--- a/spec/policies/ci/pipeline_policy_spec.rb
+++ b/spec/policies/ci/pipeline_policy_spec.rb
@@ -74,5 +74,23 @@ describe Ci::PipelinePolicy, :models do
expect(policy).to be_allowed :update_pipeline
end
end
+
+ describe 'destroy_pipeline' do
+ let(:project) { create(:project, :public) }
+
+ context 'when user has owner access' do
+ let(:user) { project.owner }
+
+ it 'is enabled' do
+ expect(policy).to be_allowed :destroy_pipeline
+ end
+ end
+
+ context 'when user is not owner' do
+ it 'is disabled' do
+ expect(policy).not_to be_allowed :destroy_pipeline
+ end
+ end
+ end
end
end