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
271061a1
Commit
271061a1
authored
Sep 09, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add check for calling add in tests
parent
f6f964a4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
lib/api/usage_data.rb
lib/api/usage_data.rb
+1
-1
spec/requests/api/usage_data_spec.rb
spec/requests/api/usage_data_spec.rb
+7
-1
No files found.
lib/api/usage_data.rb
View file @
271061a1
...
...
@@ -14,7 +14,7 @@ module API
end
params
do
requires
:event
,
type:
String
,
desc:
'The event name
i
t should be tracked'
requires
:event
,
type:
String
,
desc:
'The event name
tha
t should be tracked'
end
post
'increment_unique_users'
do
...
...
spec/requests/api/usage_data_spec.rb
View file @
271061a1
...
...
@@ -11,7 +11,7 @@ RSpec.describe API::UsageData do
let
(
:unknown_event
)
{
'unknown'
}
context
'usage_data_api feature not enabled'
do
it
'ret
ru
ns not_found'
do
it
'ret
ur
ns not_found'
do
stub_feature_flags
(
usage_data_api:
false
)
post
api
(
endpoint
,
user
),
params:
{
event:
known_event
}
...
...
@@ -31,6 +31,8 @@ RSpec.describe API::UsageData do
context
'with authentication'
do
before
do
stub_feature_flags
(
usage_data_api:
true
)
stub_feature_flags
(
"usage_data_
#{
known_event
}
"
=>
true
)
stub_application_setting
(
usage_ping_enabled:
true
)
end
context
'when event is missing from params'
do
...
...
@@ -43,6 +45,8 @@ RSpec.describe API::UsageData do
context
'with correct params'
do
it
'returns status ok'
do
expect
(
Gitlab
::
Redis
::
HLL
).
to
receive
(
:add
)
post
api
(
endpoint
,
user
),
params:
{
event:
known_event
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
@@ -51,6 +55,8 @@ RSpec.describe API::UsageData do
context
'with unknown event'
do
it
'returns status ok'
do
expect
(
Gitlab
::
Redis
::
HLL
).
not_to
receive
(
:add
)
post
api
(
endpoint
,
user
),
params:
{
event:
unknown_event
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
...
...
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