debian-mirror-gitlab/spec/support/shared_examples/controllers/unique_hll_events_examples.rb

19 lines
471 B
Ruby
Raw Normal View History

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
2021-03-11 19:13:27 +05:30
RSpec.shared_examples 'tracking unique hll events' do
2021-01-03 14:25:43 +05:30
it 'tracks unique event' do
2021-03-11 19:13:27 +05:30
expect(Gitlab::UsageDataCounters::HLLRedisCounter).to(
receive(:track_event)
.with(target_id, values: expected_type)
.and_call_original # we call original to trigger additional validations; otherwise the method is stubbed
)
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