diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/models/members/project_member_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/models/members/project_member_spec.rb')
-rw-r--r-- | spec/models/members/project_member_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/members/project_member_spec.rb b/spec/models/members/project_member_spec.rb index a9725a796bf..70f843be0e1 100644 --- a/spec/models/members/project_member_spec.rb +++ b/spec/models/members/project_member_spec.rb @@ -57,6 +57,7 @@ RSpec.describe ProjectMember, feature_category: :groups_and_projects do let_it_be(:developer) { create(:user) } let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } + let_it_be(:admin) { create(:admin) } before do project.add_owner(owner) @@ -74,6 +75,30 @@ RSpec.describe ProjectMember, feature_category: :groups_and_projects do end end + context 'when member can manage owners via admin' do + let(:user) { admin } + + context 'with admin mode', :enable_admin_mode do + it 'returns Gitlab::Access.options_with_owner' do + expect(access_levels).to eq(Gitlab::Access.options_with_owner) + end + end + + context 'without admin mode' do + it 'returns empty hash' do + expect(access_levels).to eq({}) + end + end + end + + context 'when user is not a project member' do + let(:user) { create(:user) } + + it 'return an empty hash' do + expect(access_levels).to eq({}) + end + end + context 'when member cannot manage owners' do let(:user) { maintainer } |