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

31 lines
759 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) }
2022-07-16 23:28:13 +05:30
let(:result) { { data: { track_label: 'a', track_action: 'b', track_property: 'c' } } }
before do
stub_application_setting(snowplow_enabled: true)
2019-10-12 21:52:04 +05:30
end
2022-07-16 23:28:13 +05:30
it 'returns no data if snowplow is disabled' do
stub_application_setting(snowplow_enabled: false)
expect(helper.tracking_attrs(*input)).to eq({})
2019-10-12 21:52:04 +05:30
end
2022-07-16 23:28:13 +05:30
it 'returns data hash' do
expect(helper.tracking_attrs(*input)).to eq(result)
end
2019-10-12 21:52:04 +05:30
2022-07-16 23:28:13 +05:30
it 'can return data directly' do
expect(helper.tracking_attrs_data(*input)).to eq(result[:data])
2019-09-04 21:01:54 +05:30
end
end
end