diff options
Diffstat (limited to 'spec/policies/organizations/organization_policy_spec.rb')
-rw-r--r-- | spec/policies/organizations/organization_policy_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/policies/organizations/organization_policy_spec.rb b/spec/policies/organizations/organization_policy_spec.rb new file mode 100644 index 00000000000..52d5a41aa7f --- /dev/null +++ b/spec/policies/organizations/organization_policy_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Organizations::OrganizationPolicy, feature_category: :cell do + let_it_be(:organization) { create(:organization) } + + subject(:policy) { described_class.new(current_user, organization) } + + context 'when the user is an admin' do + let_it_be(:current_user) { create(:user, :admin) } + + context 'when admin mode is enabled', :enable_admin_mode do + it { is_expected.to be_allowed(:admin_organization) } + end + + context 'when admin mode is disabled' do + it { is_expected.to be_disallowed(:admin_organization) } + end + end + + context 'when the user is not an admin' do + let_it_be(:current_user) { create(:user) } + + it { is_expected.to be_disallowed(:admin_organization) } + end +end |