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
f53b3166
Commit
f53b3166
authored
Jun 11, 2019
by
Luke Bennett
Committed by
Mayra Cabrera
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable tracking_attrs in development env
Also disable in test env.
parent
68a838d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
ee/app/helpers/ee/tracking_helper.rb
ee/app/helpers/ee/tracking_helper.rb
+4
-3
ee/spec/helpers/ee/tracking_helper_spec.rb
ee/spec/helpers/ee/tracking_helper_spec.rb
+22
-6
No files found.
ee/app/helpers/ee/tracking_helper.rb
View file @
f53b3166
...
...
@@ -6,7 +6,7 @@ module EE
override
:tracking_attrs
def
tracking_attrs
(
label
,
event
,
property
)
return
{}
unless
snowplow
_enabled?
return
{}
unless
tracking
_enabled?
{
data:
{
...
...
@@ -19,8 +19,9 @@ module EE
private
def
snowplow_enabled?
::
Gitlab
::
CurrentSettings
.
snowplow_enabled?
def
tracking_enabled?
Rails
.
env
.
production?
&&
::
Gitlab
::
CurrentSettings
.
snowplow_enabled?
end
end
end
ee/spec/helpers/ee/tracking_helper_spec.rb
View file @
f53b3166
...
...
@@ -4,16 +4,32 @@ require 'spec_helper'
describe
EE
::
TrackingHelper
do
describe
'#tracking_attrs'
do
it
'returns a hash of snowplow data attrs if snowplow is enabled'
do
stub_application_setting
(
snowplow_enabled:
true
)
using
RSpec
::
Parameterized
::
TableSyntax
expect
(
helper
.
tracking_attrs
(
'a'
,
'b'
,
'c'
)).
to
eq
(
data:
{
track_label:
'a'
,
track_event:
'b'
,
track_property:
'c'
})
let
(
:input
)
{
%w(a b c)
}
let
(
:results
)
do
{
no_data:
{},
with_data:
{
data:
{
track_label:
'a'
,
track_event:
'b'
,
track_property:
'c'
}
}
}
end
it
'returns an empty hash if snowplow is disabled'
do
stub_application_setting
(
snowplow_enabled:
false
)
where
(
:snowplow_enabled
,
:environment
,
:result
)
do
true
|
'production'
|
:with_data
false
|
'production'
|
:no_data
true
|
'development'
|
:no_data
false
|
'development'
|
:no_data
true
|
'test'
|
:no_data
false
|
'test'
|
:no_data
end
with_them
do
it
'returns a hash'
do
stub_application_setting
(
snowplow_enabled:
snowplow_enabled
)
allow
(
Rails
).
to
receive
(
:env
).
and_return
(
environment
.
inquiry
)
expect
(
helper
.
tracking_attrs
(
'a'
,
'b'
,
'c'
)).
to
eq
({})
expect
(
helper
.
tracking_attrs
(
*
input
)).
to
eq
(
results
[
result
])
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