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
1efae6b6
Commit
1efae6b6
authored
Aug 25, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add skip_before_action in controller
parent
8355359d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
spec/controllers/concerns/redis_tracking_spec.rb
spec/controllers/concerns/redis_tracking_spec.rb
+22
-3
No files found.
spec/controllers/concerns/redis_tracking_spec.rb
View file @
1efae6b6
...
...
@@ -10,9 +10,8 @@ RSpec.describe RedisTracking do
controller
(
ApplicationController
)
do
include
RedisTracking
skip_before_action
track_redis_hll_event
:index
,
name:
'i_analytics_dev_ops_score'
,
feature: :g_compliance_dashboard_feature
skip_before_action
:authenticate_user!
,
only: :show
track_redis_hll_event
:index
,
:show
,
name:
'i_analytics_dev_ops_score'
,
feature: :g_compliance_dashboard_feature
def
index
render
html:
'index'
...
...
@@ -21,6 +20,10 @@ RSpec.describe RedisTracking do
def
new
render
html:
'new'
end
def
show
render
html:
'show'
end
end
context
'with feature disabled'
do
...
...
@@ -60,6 +63,22 @@ RSpec.describe RedisTracking do
end
end
context
'when user is not logged in and there is a visitor_id'
do
let
(
:visitor_id
)
{
SecureRandom
.
uuid
}
before
do
routes
.
draw
{
get
'show'
=>
'anonymous#show'
}
end
it
'tracks the event'
do
cookies
[
:visitor_id
]
=
{
value:
visitor_id
,
expires:
24
.
months
}
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
to
receive
(
:track_event
)
get
:show
end
end
context
'when user is not logged in and there is no visitor_id'
do
it
'does not tracks the event'
do
expect
(
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
).
not_to
receive
(
:track_event
)
...
...
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