diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 15:08:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 15:08:33 +0300 |
commit | 1808454313ed75c92e1384466e8c83bfbc8ae25e (patch) | |
tree | 5c006c158fd796dc6d21e9bd771542f2fb0c24e2 /spec/finders/members_finder_spec.rb | |
parent | fd3a95f07ae9cd78fecffcfa5de4494f933a7808 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders/members_finder_spec.rb')
-rw-r--r-- | spec/finders/members_finder_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/finders/members_finder_spec.rb b/spec/finders/members_finder_spec.rb index 2bc37606a25..f7331f689ea 100644 --- a/spec/finders/members_finder_spec.rb +++ b/spec/finders/members_finder_spec.rb @@ -75,6 +75,15 @@ describe MembersFinder, '#execute' do expect(result).to contain_exactly(member2, member3) end + it 'returns only inherited members of a personal project' do + project = create(:project, namespace: user1.namespace) + member = project.members.first + + result = described_class.new(project, user1).execute(include_relations: [:inherited]) + + expect(result).to contain_exactly(member) + end + it 'returns the members.access_level when the user is invited', :nested_groups do member_invite = create(:project_member, :invited, project: project, invite_email: create(:user).email) member1 = group.add_maintainer(user2) @@ -96,6 +105,26 @@ describe MembersFinder, '#execute' do expect(result.first.access_level).to eq(Gitlab::Access::DEVELOPER) end + it 'returns searched members if requested' do + project.add_maintainer(user2) + project.add_maintainer(user3) + member3 = project.add_maintainer(user4) + + result = described_class.new(project, user2).execute(params: { search: user4.name }) + + expect(result).to contain_exactly(member3) + end + + it 'returns members sorted by id_desc' do + member1 = project.add_maintainer(user2) + member2 = project.add_maintainer(user3) + member3 = project.add_maintainer(user4) + + result = described_class.new(project, user2).execute(params: { sort: 'id_desc' }) + + expect(result).to eq([member3, member2, member1]) + end + context 'when include_invited_groups_members == true' do subject { described_class.new(project, user2).execute(include_relations: [:inherited, :direct, :invited_groups_members]) } |