Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/policies/deploy_key_policy_spec.rb')
-rw-r--r--spec/policies/deploy_key_policy_spec.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/policies/deploy_key_policy_spec.rb b/spec/policies/deploy_key_policy_spec.rb
index aca93d8fe85..545647e2c67 100644
--- a/spec/policies/deploy_key_policy_spec.rb
+++ b/spec/policies/deploy_key_policy_spec.rb
@@ -42,16 +42,28 @@ describe DeployKeyPolicy do
context 'when an admin user' do
let(:current_user) { create(:user, :admin) }
- context ' tries to update private deploy key' do
+ context 'tries to update private deploy key' do
let(:deploy_key) { create(:deploy_key, public: false) }
- it { is_expected.to be_allowed(:update_deploy_key) }
+ context 'when admin mode enabled', :enable_admin_mode do
+ it { is_expected.to be_allowed(:update_deploy_key) }
+ end
+
+ context 'when admin mode disabled' do
+ it { is_expected.to be_disallowed(:update_deploy_key) }
+ end
end
context 'when an admin user tries to update public deploy key' do
let(:deploy_key) { create(:another_deploy_key, public: true) }
- it { is_expected.to be_allowed(:update_deploy_key) }
+ context 'when admin mode enabled', :enable_admin_mode do
+ it { is_expected.to be_allowed(:update_deploy_key) }
+ end
+
+ context 'when admin mode disabled' do
+ it { is_expected.to be_disallowed(:update_deploy_key) }
+ end
end
end
end