Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
b900c40f
Commit
b900c40f
authored
2 years ago
by
Niko Belokolodov
Committed by
Allen Cook
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Refactor Snowplow tracking specs"
parent
e7c88821
No related branches found
No related tags found
1 merge request
!100994
Resolve "Refactor Snowplow tracking specs"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/controllers/concerns/product_analytics_tracking_spec.rb
+21
-12
21 additions, 12 deletions
spec/controllers/concerns/product_analytics_tracking_spec.rb
with
21 additions
and
12 deletions
spec/controllers/concerns/product_analytics_tracking_spec.rb
+
21
−
12
View file @
b900c40f
...
...
@@ -51,11 +51,9 @@ def custom_condition_two?
end
end
def
expect_
tracking
(
user:
self
.
user
)
def
expect_
redis_hll_tracking
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
to
have_received
(
:track_event
)
.
with
(
'g_analytics_valuestream'
,
values:
instance_of
(
String
))
expect_snowplow_tracking
(
user
)
end
def
expect_snowplow_tracking
(
user
)
...
...
@@ -85,7 +83,8 @@ def expect_no_tracking
it
'tracks the event'
do
get
:index
expect_tracking
expect_redis_hll_tracking
expect_snowplow_tracking
(
user
)
end
context
'when FF is disabled'
do
...
...
@@ -105,7 +104,8 @@ def expect_no_tracking
get
:index
expect_tracking
expect_redis_hll_tracking
expect_snowplow_tracking
(
user
)
end
it
'does not track the event if DNT is enabled'
do
...
...
@@ -145,7 +145,8 @@ def expect_no_tracking
get
:show
,
params:
{
id:
1
}
expect_tracking
(
user:
nil
)
expect_redis_hll_tracking
expect_snowplow_tracking
(
nil
)
end
end
...
...
@@ -159,16 +160,24 @@ def expect_no_tracking
it
'tracks the event when there is custom id'
do
get
:show
,
params:
{
id:
1
}
expect_tracking
(
user:
nil
)
expect_redis_hll_tracking
expect_snowplow_tracking
(
nil
)
end
it
'does not track the HLL event when there is no custom id'
do
allow
(
controller
).
to
receive
(
:get_custom_id
).
and_return
(
nil
)
context
'when there is no custom_id set'
do
before
do
allow
(
controller
).
to
receive
(
:get_custom_id
).
and_return
(
nil
)
get
:show
,
params:
{
id:
2
}
get
:show
,
params:
{
id:
2
}
end
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
not_to
receive
(
:track_event
)
expect_snowplow_tracking
(
nil
)
it
'does not track the HLL event'
do
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
not_to
receive
(
:track_event
)
end
it
'tracks Snowplow event'
do
expect_snowplow_tracking
(
nil
)
end
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment