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
b89d7c4d
Commit
b89d7c4d
authored
Mar 19, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce a new EE::Repository#insights_config_for method
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
eaba1acc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
ee/app/models/ee/repository.rb
ee/app/models/ee/repository.rb
+4
-0
ee/lib/gitlab/insights.rb
ee/lib/gitlab/insights.rb
+1
-0
ee/spec/models/repository_spec.rb
ee/spec/models/repository_spec.rb
+21
-0
No files found.
ee/app/models/ee/repository.rb
View file @
b89d7c4d
...
...
@@ -103,5 +103,9 @@ module EE
possible_code_owner_blobs
=
::
Gitlab
::
CodeOwners
::
FILE_PATHS
.
map
{
|
path
|
[
ref
,
path
]
}
blobs_at
(
possible_code_owner_blobs
).
compact
.
first
end
def
insights_config_for
(
sha
)
blob_data_at
(
sha
,
::
Gitlab
::
Insights
::
CONFIG_FILE_PATH
)
end
end
end
ee/lib/gitlab/insights.rb
View file @
b89d7c4d
...
...
@@ -2,6 +2,7 @@
module
Gitlab
module
Insights
CONFIG_FILE_PATH
=
'.gitlab/insights.yml'
COLOR_SCHEME
=
{
red:
'#e6194b'
,
green:
'#3cb44b'
,
...
...
ee/spec/models/repository_spec.rb
View file @
b89d7c4d
...
...
@@ -187,4 +187,25 @@ describe Repository do
.
not_to
change
{
::
Geo
::
RepositoryUpdatedEvent
.
count
}
end
end
describe
"#insights_config_for"
do
context
'when no config file exists'
do
it
'returns nil if does not exist'
do
expect
(
repository
.
insights_config_for
(
repository
.
root_ref
)).
to
be_nil
end
end
it
'returns nil for an empty repository'
do
allow
(
repository
).
to
receive
(
:empty?
).
and_return
(
true
)
expect
(
repository
.
insights_config_for
(
repository
.
root_ref
)).
to
be_nil
end
it
'returns a valid Insights config file'
do
project
=
create
(
:project
,
:custom_repo
,
files:
{
Gitlab
::
Insights
::
CONFIG_FILE_PATH
=>
'- key: monthlyBugsCreated'
})
insights_config_blob
=
project
.
repository
.
blob_at
(
project
.
repository
.
root_ref
,
Gitlab
::
Insights
::
CONFIG_FILE_PATH
)
expect
(
project
.
repository
.
insights_config_for
(
project
.
repository
.
root_ref
)).
to
eq
(
'- key: monthlyBugsCreated'
)
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