summaryrefslogtreecommitdiff
path: root/spec/policies/environment_policy_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /spec/policies/environment_policy_spec.rb
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/policies/environment_policy_spec.rb')
-rw-r--r--spec/policies/environment_policy_spec.rb32
1 files changed, 28 insertions, 4 deletions
diff --git a/spec/policies/environment_policy_spec.rb b/spec/policies/environment_policy_spec.rb
index a098b52023d..75fca464ec8 100644
--- a/spec/policies/environment_policy_spec.rb
+++ b/spec/policies/environment_policy_spec.rb
@@ -37,7 +37,13 @@ describe EnvironmentPolicy do
context 'when an admin user' do
let(:user) { create(:user, :admin) }
- it { expect(policy).to be_allowed :stop_environment }
+ context 'when admin mode is enabled', :enable_admin_mode do
+ it { expect(policy).to be_allowed :stop_environment }
+ end
+
+ context 'when admin mode is disabled' do
+ it { expect(policy).to be_disallowed :stop_environment }
+ end
end
context 'with protected branch' do
@@ -54,7 +60,13 @@ describe EnvironmentPolicy do
context 'when an admin user' do
let(:user) { create(:user, :admin) }
- it { expect(policy).to be_allowed :stop_environment }
+ context 'when admin mode is enabled', :enable_admin_mode do
+ it { expect(policy).to be_allowed :stop_environment }
+ end
+
+ context 'when admin mode is disabled' do
+ it { expect(policy).to be_disallowed :stop_environment }
+ end
end
end
end
@@ -83,7 +95,13 @@ describe EnvironmentPolicy do
context 'when an admin user' do
let(:user) { create(:user, :admin) }
- it { expect(policy).to be_allowed :stop_environment }
+ context 'when admin mode is enabled', :enable_admin_mode do
+ it { expect(policy).to be_allowed :stop_environment }
+ end
+
+ context 'when admin mode is disabled' do
+ it { expect(policy).to be_disallowed :stop_environment }
+ end
end
end
@@ -126,7 +144,13 @@ describe EnvironmentPolicy do
environment.stop!
end
- it { expect(policy).to be_allowed :destroy_environment }
+ context 'when admin mode is enabled', :enable_admin_mode do
+ it { expect(policy).to be_allowed :destroy_environment }
+ end
+
+ context 'when admin mode is disabled' do
+ it { expect(policy).to be_disallowed :destroy_environment }
+ end
end
end
end