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
4b663bbe
Commit
4b663bbe
authored
Jan 25, 2021
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use git add . for checking skip_validation
parent
ac440507
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
lib/gitlab/usage/metric_definition.rb
lib/gitlab/usage/metric_definition.rb
+1
-3
spec/lib/gitlab/usage/metric_definition_spec.rb
spec/lib/gitlab/usage/metric_definition_spec.rb
+11
-3
No files found.
lib/gitlab/usage/metric_definition.rb
View file @
4b663bbe
...
...
@@ -82,9 +82,7 @@ module Gitlab
end
def
skip_validation?
return
false
if
attributes
[
:skip_validation
].
blank?
attributes
[
:skip_validation
]
!!
attributes
[
:skip_validation
]
end
end
end
...
...
spec/lib/gitlab/usage/metric_definition_spec.rb
View file @
4b663bbe
...
...
@@ -66,6 +66,13 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
described_class
.
new
(
path
,
attributes
).
validate!
end
context
'with skip_validation'
do
it
'raise exception if skip_validation: false'
do
expect
(
Gitlab
::
ErrorTracking
).
to
receive
(
:track_and_raise_for_dev_exception
).
at_least
(
:once
).
with
(
instance_of
(
Gitlab
::
Usage
::
Metric
::
InvalidMetricError
))
described_class
.
new
(
path
,
attributes
.
merge
(
{
skip_validation:
false
}
)).
validate!
end
it
'does not raise exception if has skip_validation: true'
do
expect
(
Gitlab
::
ErrorTracking
).
not_to
receive
(
:track_and_raise_for_dev_exception
)
...
...
@@ -73,6 +80,7 @@ RSpec.describe Gitlab::Usage::MetricDefinition do
end
end
end
end
describe
'.load_all!'
do
let
(
:metric1
)
{
Dir
.
mktmpdir
(
'metric1'
)
}
...
...
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