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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-05 15:11:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-05 15:11:04 +0300
commit164ac94bbd2eadc02ab54322a6fe12ed48ae8041 (patch)
tree6eec29a4fd554eeb6f4a1b296e37bdf6fb5f6f80 /spec/policies
parent8934df30a36d16ac9de9aebb079e16f16fda6912 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r--spec/policies/organizations/organization_policy_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/policies/organizations/organization_policy_spec.rb b/spec/policies/organizations/organization_policy_spec.rb
index e51362227c9..3fcfa63b1b2 100644
--- a/spec/policies/organizations/organization_policy_spec.rb
+++ b/spec/policies/organizations/organization_policy_spec.rb
@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Organizations::OrganizationPolicy, feature_category: :cell do
let_it_be(:organization) { create(:organization) }
+ let_it_be(:current_user) { create :user }
subject(:policy) { described_class.new(current_user, organization) }
@@ -19,6 +20,7 @@ RSpec.describe Organizations::OrganizationPolicy, feature_category: :cell do
context 'when admin mode is enabled', :enable_admin_mode do
it { is_expected.to be_allowed(:admin_organization) }
it { is_expected.to be_allowed(:read_organization) }
+ it { is_expected.to be_allowed(:read_organization_user) }
end
context 'when admin mode is disabled' do
@@ -27,13 +29,19 @@ RSpec.describe Organizations::OrganizationPolicy, feature_category: :cell do
end
end
- context 'when the user is an organization user' do
- let_it_be(:current_user) { create :user }
-
+ context 'when the user is part of the organization' do
before do
create :organization_user, organization: organization, user: current_user
end
+ it { is_expected.to be_allowed(:read_organization_user) }
+ it { is_expected.to be_allowed(:read_organization) }
+ end
+
+ context 'when the user is not part of the organization' do
+ it { is_expected.to be_disallowed(:read_organization_user) }
+ # All organizations are currently public, and hence they are allowed to be read
+ # even if the user is not a part of the organization.
it { is_expected.to be_allowed(:read_organization) }
end
end