gitlab-org--gitlab-foss/spec/helpers/tracking_helper_spec.rb
Jeremy Jackson 5d9d5e6031 Migrates Snowplow backend from EE to CE
This introduces several changes, but these are all just ported from the
EE project.
2019-08-14 19:21:58 +00:00

35 lines
927 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe TrackingHelper do
describe '#tracking_attrs' do
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