summaryrefslogtreecommitdiff
path: root/spec/helpers/tracking_helper_spec.rb
diff options
context:
space:
mode:
authorJeremy Jackson <jjackson@gitlab.com>2019-08-14 19:21:58 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-08-14 19:21:58 +0000
commit5d9d5e603119c3ae334b0855a63d10d12b2390bd (patch)
tree0fd0becd40de3ecb95ff123e8973dc43b537f25b /spec/helpers/tracking_helper_spec.rb
parent7f9c653ef4c90a039ede690da1bc9d0524ffcc95 (diff)
downloadgitlab-ce-5d9d5e603119c3ae334b0855a63d10d12b2390bd.tar.gz
Migrates Snowplow backend from EE to CE
This introduces several changes, but these are all just ported from the EE project.
Diffstat (limited to 'spec/helpers/tracking_helper_spec.rb')
-rw-r--r--spec/helpers/tracking_helper_spec.rb28
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/helpers/tracking_helper_spec.rb b/spec/helpers/tracking_helper_spec.rb
index 71505e8ea69..b0c98be4130 100644
--- a/spec/helpers/tracking_helper_spec.rb
+++ b/spec/helpers/tracking_helper_spec.rb
@@ -4,8 +4,32 @@ require 'spec_helper'
describe TrackingHelper do
describe '#tracking_attrs' do
- it 'returns an empty hash' do
- expect(helper.tracking_attrs('a', 'b', 'c')).to eq({})
+ using RSpec::Parameterized::TableSyntax
+
+ let(:input) { %w(a b c) }
+ let(:results) do
+ {
+ no_data: {},
+ with_data: { data: { track_label: 'a', track_event: 'b', track_property: 'c' } }
+ }
+ end
+
+ 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(*input)).to eq(results[result])
+ end
end
end
end