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

service_ping_context_spec.rb « tracking « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d70dfaa4e0b51b2ce2ef15f182667bdbcb15781c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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