Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
89fb1215
Commit
89fb1215
authored
Dec 21, 2021
by
Vijay Hawoldar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust specs for member scope
parent
0f117a67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
ee/spec/models/member_spec.rb
ee/spec/models/member_spec.rb
+16
-6
No files found.
ee/spec/models/member_spec.rb
View file @
89fb1215
...
...
@@ -253,33 +253,43 @@ RSpec.describe Member, type: :model do
let_it_be
(
:awaiting_project_member
)
{
create
(
:project_member
,
:awaiting
,
project:
project
)
}
let_it_be
(
:awaiting_invited_member
)
{
create
(
:group_member
,
:awaiting
,
:invited
,
group:
group
)
}
let_it_be
(
:active_invited_member
)
{
create
(
:group_member
,
:invited
,
group:
group
)
}
let_it_be
(
:awaiting_previously_invited_member
)
do
member
=
create
(
:group_member
,
:awaiting
,
:invited
,
group:
group
)
user
=
create
(
:user
)
member
.
accept_invite!
(
user
)
member
end
subject
(
:results
)
{
described_class
.
distinct_awaiting_or_invited_for_group
(
group
)
}
it
'returns the correct members'
do
expect
(
results
.
size
).
to
eq
5
expect
(
results
).
to
match_array
[
expect
(
results
).
to
contain_exactly
(
awaiting_group_member
,
awaiting_subgroup_member
,
awaiting_project_member
,
awaiting_invited_member
,
awaiting_previously_invited_member
,
active_invited_member
]
)
end
it
'does not return additional results for duplicates'
do
create
(
:group_member
,
:awaiting
,
group:
sub_group
,
user:
awaiting_group_member
.
user
)
create
(
:group_member
,
:invited
,
group:
sub_group
,
invite_email:
awaiting_invited_member
.
invite_email
)
create
(
:group_member
,
:awaiting
,
group:
sub_group
,
invite_email:
awaiting_previously_invited_member
.
invite_email
,
user:
awaiting_previously_invited_member
.
user
)
expect
(
results
.
size
).
to
eq
5
expect
(
results
.
map
(
&
:user_id
).
compact
).
to
contain_exactly
(
awaiting_group_member
.
user_id
,
awaiting_subgroup_member
.
user_id
,
awaiting_project_member
.
user_id
awaiting_project_member
.
user_id
,
awaiting_previously_invited_member
.
user_id
)
expect
(
results
.
map
(
&
:invite_email
).
compact
).
to
contain_exactly
(
awaiting_invited_member
.
invite_email
,
active_invited_member
.
invite_email
active_invited_member
.
invite_email
,
awaiting_previously_invited_member
.
invite_email
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment