debian-mirror-gitlab/spec/helpers/tracking_helper_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
934 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe TrackingHelper do
2019-09-04 21:01:54 +05:30
describe '#tracking_attrs' do
2019-10-12 21:52:04 +05:30
using RSpec::Parameterized::TableSyntax
let(:input) { %w(a b c) }
let(:results) do
{
no_data: {},
2021-04-29 21:17:54 +05:30
with_data: { data: { track_label: 'a', track_action: 'b', track_property: 'c' } }
2019-10-12 21:52:04 +05:30
}
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
2019-09-04 21:01:54 +05:30
end
end
end