diff options
Diffstat (limited to 'spec/lib/gitlab/tracking_spec.rb')
-rw-r--r-- | spec/lib/gitlab/tracking_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index 805bd92fd43..57882de0974 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -36,6 +36,11 @@ RSpec.describe Gitlab::Tracking do end describe '.event' do + before do + allow_any_instance_of(Gitlab::Tracking::Destinations::Snowplow).to receive(:event) + allow_any_instance_of(Gitlab::Tracking::Destinations::ProductAnalytics).to receive(:event) + end + it 'delegates to snowplow destination' do expect_any_instance_of(Gitlab::Tracking::Destinations::Snowplow) .to receive(:event) @@ -43,15 +48,23 @@ RSpec.describe Gitlab::Tracking do described_class.event('category', 'action', label: 'label', property: 'property', value: 1.5) end + + it 'delegates to ProductAnalytics destination' do + expect_any_instance_of(Gitlab::Tracking::Destinations::ProductAnalytics) + .to receive(:event) + .with('category', 'action', label: 'label', property: 'property', value: 1.5, context: nil) + + described_class.event('category', 'action', label: 'label', property: 'property', value: 1.5) + end end describe '.self_describing_event' do it 'delegates to snowplow destination' do expect_any_instance_of(Gitlab::Tracking::Destinations::Snowplow) .to receive(:self_describing_event) - .with('iglu:com.gitlab/foo/jsonschema/1-0-0', { foo: 'bar' }, context: nil) + .with('iglu:com.gitlab/foo/jsonschema/1-0-0', data: { foo: 'bar' }, context: nil) - described_class.self_describing_event('iglu:com.gitlab/foo/jsonschema/1-0-0', foo: 'bar') + described_class.self_describing_event('iglu:com.gitlab/foo/jsonschema/1-0-0', data: { foo: 'bar' }) end end end |