diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-15 18:08:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-15 18:08:04 +0300 |
commit | c4c1fc5fe7c756fc6f8f79eb1624b1bbe4fe2d69 (patch) | |
tree | 8c95e39fc4956cdd9178c46ea85cbeeeac3bc360 /spec/policies/environment_policy_spec.rb | |
parent | 927df95cc4453bdacbc59960df32008b02c4e28a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies/environment_policy_spec.rb')
-rw-r--r-- | spec/policies/environment_policy_spec.rb | 32 |
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 |