Welcome to mirror list, hosted at ThFree Co, Russian Federation.

unique_hll_events_examples.rb « controllers « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c5d65743810126dce78a43d9074cf5261a3b4590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
#
# Requires a context containing:
# - request
# - expected_type
# - target_id

RSpec.shared_examples 'tracking unique hll events' do |feature_flag|
  it 'tracks unique event' do
    expect(Gitlab::UsageDataCounters::HLLRedisCounter).to receive(:track_event).with(target_id, values: expected_type)

    request
  end

  context 'when feature flag is disabled' do
    it 'does not track unique event' do
      stub_feature_flags(feature_flag => false)

      expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to receive(:track_event)

      request
    end
  end
end