2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
2021-01-03 14:25:43 +05:30
|
|
|
#
|
|
|
|
# Requires a context containing:
|
|
|
|
# - request
|
|
|
|
# - expected_type
|
|
|
|
# - target_id
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
RSpec.shared_examples 'tracking unique hll events' do |feature_flag|
|
2021-01-03 14:25:43 +05:30
|
|
|
it 'tracks unique event' do
|
|
|
|
expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(expected_type, target_id)
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
request
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
context 'when feature flag is disabled' do
|
|
|
|
it 'does not track unique event' do
|
|
|
|
stub_feature_flags(feature_flag => false)
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event)
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
request
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|