diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-17 09:14:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-17 09:14:40 +0300 |
commit | 42deff0c17c1a34f716a299db79bb9c3788c265f (patch) | |
tree | 8e51495a5e98fa0de7336165e6c32248df036772 /spec/models | |
parent | 6b872432bfad793b9cd89a4a17dffebfb1ae0e09 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/user_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d263bcde0ca..cc0ea69401e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -6390,6 +6390,34 @@ RSpec.describe User, feature_category: :user_profile do end end + describe '#max_member_access_for_group' do + let(:user) { create(:user) } + let(:group) { create(:group) } + + context 'when user has no access' do + it 'returns Gitlab::Access::NO_ACCESS' do + expect(user.max_member_access_for_group(group.id)).to eq(Gitlab::Access::NO_ACCESS) + end + end + + context 'when user has access via a single permission' do + it 'returns Gitlab::Access::DEVELOPER' do + group.add_developer(user) + + expect(user.max_member_access_for_group(group.id)).to eq(Gitlab::Access::DEVELOPER) + end + end + + context 'when user has access via a multiple groups' do + it 'returns Gitlab::Access::MAINTAINER' do + group.add_developer(user) + group.add_maintainer(user) + + expect(user.max_member_access_for_group(group.id)).to eq(Gitlab::Access::MAINTAINER) + end + end + end + context 'changing a username' do let(:user) { create(:user, username: 'foo') } |