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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
b674ab52
Commit
b674ab52
authored
Sep 20, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for ProjectTeam#fetch_members
parent
9346a8d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
+67
-0
spec/factories/group_members.rb
spec/factories/group_members.rb
+6
-0
spec/models/project_team_spec.rb
spec/models/project_team_spec.rb
+61
-0
No files found.
spec/factories/group_members.rb
View file @
b674ab52
...
...
@@ -3,5 +3,11 @@ FactoryGirl.define do
access_level
{
GroupMember
::
OWNER
}
group
user
trait
(
:guest
)
{
access_level
GroupMember
::
GUEST
}
trait
(
:reporter
)
{
access_level
GroupMember
::
REPORTER
}
trait
(
:developer
)
{
access_level
GroupMember
::
DEVELOPER
}
trait
(
:master
)
{
access_level
GroupMember
::
MASTER
}
trait
(
:owner
)
{
access_level
GroupMember
::
OWNER
}
end
end
spec/models/project_team_spec.rb
View file @
b674ab52
...
...
@@ -73,6 +73,67 @@ describe ProjectTeam, models: true do
end
end
describe
'#fetch_members'
do
context
'personal project'
do
let
(
:project
)
{
create
(
:empty_project
)
}
it
'returns project members'
do
user
=
create
(
:user
)
project
.
team
<<
[
user
,
:guest
]
expect
(
project
.
team
.
members
).
to
contain_exactly
(
user
)
end
it
'returns project members of a specified level'
do
user
=
create
(
:user
)
project
.
team
<<
[
user
,
:reporter
]
expect
(
project
.
team
.
guests
).
to
be_empty
expect
(
project
.
team
.
reporters
).
to
contain_exactly
(
user
)
end
it
'returns invited members of a group'
do
group_member
=
create
(
:group_member
)
project
.
project_group_links
.
create!
(
group:
group_member
.
group
,
group_access:
Gitlab
::
Access
::
GUEST
)
expect
(
project
.
team
.
members
).
to
contain_exactly
(
group_member
.
user
)
end
it
'returns invited members of a group of a specified level'
do
group_member
=
create
(
:group_member
)
project
.
project_group_links
.
create!
(
group:
group_member
.
group
,
group_access:
Gitlab
::
Access
::
REPORTER
)
expect
(
project
.
team
.
reporters
).
to
contain_exactly
(
group_member
.
user
)
end
end
context
'group project'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:empty_project
,
group:
group
)
}
it
'returns project members'
do
group_member
=
create
(
:group_member
,
group:
group
)
expect
(
project
.
team
.
members
).
to
contain_exactly
(
group_member
.
user
)
end
it
'returns project members of a specified level'
do
group_member
=
create
(
:group_member
,
:reporter
,
group:
group
)
expect
(
project
.
team
.
guests
).
to
be_empty
expect
(
project
.
team
.
reporters
).
to
contain_exactly
(
group_member
.
user
)
end
end
end
describe
'#find_member'
do
context
'personal project'
do
let
(
:project
)
{
create
(
:empty_project
)
}
...
...
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