diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/lib/gitlab/tracking | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/lib/gitlab/tracking')
-rw-r--r-- | spec/lib/gitlab/tracking/destinations/snowplow_spec.rb | 23 | ||||
-rw-r--r-- | spec/lib/gitlab/tracking/standard_context_spec.rb | 12 |
2 files changed, 9 insertions, 26 deletions
diff --git a/spec/lib/gitlab/tracking/destinations/snowplow_spec.rb b/spec/lib/gitlab/tracking/destinations/snowplow_spec.rb index 0e8647ad78a..65597e6568d 100644 --- a/spec/lib/gitlab/tracking/destinations/snowplow_spec.rb +++ b/spec/lib/gitlab/tracking/destinations/snowplow_spec.rb @@ -41,21 +41,6 @@ RSpec.describe Gitlab::Tracking::Destinations::Snowplow do .with('category', 'action', 'label', 'property', 1.5, nil, (Time.now.to_f * 1000).to_i) end end - - describe '#self_describing_event' do - it 'sends event to tracker' do - allow(tracker).to receive(:track_self_describing_event).and_call_original - - subject.self_describing_event('iglu:com.gitlab/foo/jsonschema/1-0-0', data: { foo: 'bar' }) - - expect(tracker).to have_received(:track_self_describing_event) do |event, context, timestamp| - expect(event.to_json[:schema]).to eq('iglu:com.gitlab/foo/jsonschema/1-0-0') - expect(event.to_json[:data]).to eq(foo: 'bar') - expect(context).to eq(nil) - expect(timestamp).to eq((Time.now.to_f * 1000).to_i) - end - end - end end context 'when snowplow is not enabled' do @@ -66,13 +51,5 @@ RSpec.describe Gitlab::Tracking::Destinations::Snowplow do subject.event('category', 'action', label: 'label', property: 'property', value: 1.5) end end - - describe '#self_describing_event' do - it 'does not send event to tracker' do - expect_any_instance_of(SnowplowTracker::Tracker).not_to receive(:track_self_describing_event) - - subject.self_describing_event('iglu:com.gitlab/foo/jsonschema/1-0-0', data: { foo: 'bar' }) - end - end end end diff --git a/spec/lib/gitlab/tracking/standard_context_spec.rb b/spec/lib/gitlab/tracking/standard_context_spec.rb index 561edbd38f8..dacd08cf12b 100644 --- a/spec/lib/gitlab/tracking/standard_context_spec.rb +++ b/spec/lib/gitlab/tracking/standard_context_spec.rb @@ -58,10 +58,16 @@ RSpec.describe Gitlab::Tracking::StandardContext do end context 'with extra data' do - subject { described_class.new(foo: 'bar') } + subject { described_class.new(extra_key_1: 'extra value 1', extra_key_2: 'extra value 2') } - it 'creates a Snowplow context with the given data' do - expect(snowplow_context.to_json.dig(:data, :foo)).to eq('bar') + it 'includes extra data in `extra` hash' do + expect(snowplow_context.to_json.dig(:data, :extra)).to eq(extra_key_1: 'extra value 1', extra_key_2: 'extra value 2') + end + end + + context 'without extra data' do + it 'contains an empty `extra` hash' do + expect(snowplow_context.to_json.dig(:data, :extra)).to be_empty end end |