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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/tracking/service_ping_context_spec.rb')
-rw-r--r--spec/lib/gitlab/tracking/service_ping_context_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/lib/gitlab/tracking/service_ping_context_spec.rb b/spec/lib/gitlab/tracking/service_ping_context_spec.rb
new file mode 100644
index 00000000000..d70dfaa4e0b
--- /dev/null
+++ b/spec/lib/gitlab/tracking/service_ping_context_spec.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Tracking::ServicePingContext do
+ describe '#init' do
+ it 'does not accept unsupported data sources' do
+ expect { described_class.new(data_source: :random, event: 'event a') }.to raise_error(ArgumentError)
+ end
+ end
+
+ describe '#to_context' do
+ let(:subject) { described_class.new(data_source: :redis_hll, event: 'sample_event') }
+
+ it 'contains event_name' do
+ expect(subject.to_context.to_json.dig(:data, :event_name)).to eq('sample_event')
+ end
+ end
+end