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
226c4646
Commit
226c4646
authored
Jul 20, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match usage_data.rb files for database review
parent
b600de60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
lib/gitlab/danger/helper.rb
lib/gitlab/danger/helper.rb
+1
-1
spec/lib/gitlab/danger/helper_spec.rb
spec/lib/gitlab/danger/helper_spec.rb
+13
-2
No files found.
lib/gitlab/danger/helper.rb
View file @
226c4646
...
@@ -124,7 +124,7 @@ module Gitlab
...
@@ -124,7 +124,7 @@ module Gitlab
}.
freeze
}.
freeze
# First-match win, so be sure to put more specific regex at the top...
# First-match win, so be sure to put more specific regex at the top...
CATEGORIES
=
{
CATEGORIES
=
{
[
%r{usage_data}
,
%r{^(
\+
|-).*(count|distinct_count)
\(
.*
\)
(.*)$}
]
=>
[
:database
,
:backend
],
[
%r{usage_data
\.
rb
}
,
%r{^(
\+
|-).*(count|distinct_count)
\(
.*
\)
(.*)$}
]
=>
[
:database
,
:backend
],
%r{
\A
doc/.*(
\.
(md|png|gif|jpg))
\z
}
=>
:docs
,
%r{
\A
doc/.*(
\.
(md|png|gif|jpg))
\z
}
=>
:docs
,
%r{
\A
(CONTRIBUTING|LICENSE|MAINTENANCE|PHILOSOPHY|PROCESS|README)(
\.
md)?
\z
}
=>
:docs
,
%r{
\A
(CONTRIBUTING|LICENSE|MAINTENANCE|PHILOSOPHY|PROCESS|README)(
\.
md)?
\z
}
=>
:docs
,
...
...
spec/lib/gitlab/danger/helper_spec.rb
View file @
226c4646
...
@@ -295,9 +295,13 @@ RSpec.describe Gitlab::Danger::Helper do
...
@@ -295,9 +295,13 @@ RSpec.describe Gitlab::Danger::Helper do
context
'having specific changes'
do
context
'having specific changes'
do
it
'has database and backend categories'
do
it
'has database and backend categories'
do
allow
(
fake_git
).
to
receive
(
:diff_for_file
).
with
(
'usage_data.rb'
)
{
double
(
:diff
,
patch:
"+ count(User.active)"
)
}
changed_files
=
[
'usage_data.rb'
,
'lib/gitlab/usage_data.rb'
,
'ee/lib/ee/gitlab/usage_data.rb'
]
expect
(
helper
.
categories_for_file
(
'usage_data.rb'
)).
to
eq
([
:database
,
:backend
])
changed_files
.
each
do
|
file
|
allow
(
fake_git
).
to
receive
(
:diff_for_file
).
with
(
file
)
{
double
(
:diff
,
patch:
"+ count(User.active)"
)
}
expect
(
helper
.
categories_for_file
(
file
)).
to
eq
([
:database
,
:backend
])
end
end
end
it
'has backend category'
do
it
'has backend category'
do
...
@@ -311,6 +315,13 @@ RSpec.describe Gitlab::Danger::Helper do
...
@@ -311,6 +315,13 @@ RSpec.describe Gitlab::Danger::Helper do
expect
(
helper
.
categories_for_file
(
'user.rb'
)).
to
eq
([
:backend
])
expect
(
helper
.
categories_for_file
(
'user.rb'
)).
to
eq
([
:backend
])
end
end
it
'has backend category for files that are not usage_data.rb'
do
changed_file
=
'usage_data/topology.rb'
allow
(
fake_git
).
to
receive
(
:diff_for_file
).
with
(
changed_file
)
{
double
(
:diff
,
patch:
"+ count(User.active)"
)
}
expect
(
helper
.
categories_for_file
(
changed_file
)).
to
eq
([
:backend
])
end
end
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