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
7f0ec9d8
Commit
7f0ec9d8
authored
Mar 06, 2019
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support multiple roulette roles per project
parent
97357c5b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
4 deletions
+43
-4
lib/gitlab/danger/teammate.rb
lib/gitlab/danger/teammate.rb
+4
-4
spec/lib/gitlab/danger/teammate_spec.rb
spec/lib/gitlab/danger/teammate_spec.rb
+39
-0
No files found.
lib/gitlab/danger/teammate.rb
View file @
7f0ec9d8
...
...
@@ -21,21 +21,21 @@ module Gitlab
# Traintainers also count as reviewers
def
reviewer?
(
project
,
category
)
capabilities
(
project
)
==
"reviewer
#{
category
}
"
||
traintainer?
(
project
,
category
)
capabilities
(
project
)
.
include?
(
"reviewer
#{
category
}
"
)
||
traintainer?
(
project
,
category
)
end
def
traintainer?
(
project
,
category
)
capabilities
(
project
)
==
"trainee_maintainer
#{
category
}
"
capabilities
(
project
)
.
include?
(
"trainee_maintainer
#{
category
}
"
)
end
def
maintainer?
(
project
,
category
)
capabilities
(
project
)
==
"maintainer
#{
category
}
"
capabilities
(
project
)
.
include?
(
"maintainer
#{
category
}
"
)
end
private
def
capabilities
(
project
)
projects
.
fetch
(
project
,
''
)
Array
(
projects
.
fetch
(
project
,
[])
)
end
end
end
...
...
spec/lib/gitlab/danger/teammate_spec.rb
0 → 100644
View file @
7f0ec9d8
# frozen_string_literal: true
describe
Gitlab
::
Danger
::
Teammate
do
subject
{
described_class
.
new
({
'projects'
=>
projects
})
}
let
(
:projects
)
{
{
project
=>
capabilities
}
}
let
(
:project
)
{
double
}
describe
'multiple roles project project'
do
let
(
:capabilities
)
{
[
'reviewer backend'
,
'maintainer frontend'
,
'trainee_maintainer database'
]
}
it
'#reviewer? supports multiple roles per project'
do
expect
(
subject
.
reviewer?
(
project
,
'backend'
)).
to
be_truthy
end
it
'#traintainer? supports multiple roles per project'
do
expect
(
subject
.
traintainer?
(
project
,
'database'
)).
to
be_truthy
end
it
'#maintainer? supports multiple roles per project'
do
expect
(
subject
.
maintainer?
(
project
,
'frontend'
)).
to
be_truthy
end
end
describe
'one role project project'
do
let
(
:capabilities
)
{
'reviewer backend'
}
it
'#reviewer? supports one role per project'
do
expect
(
subject
.
reviewer?
(
project
,
'backend'
)).
to
be_truthy
end
it
'#traintainer? supports one role per project'
do
expect
(
subject
.
traintainer?
(
project
,
'database'
)).
to
be_falsey
end
it
'#maintainer? supports one role per project'
do
expect
(
subject
.
maintainer?
(
project
,
'frontend'
)).
to
be_falsey
end
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