Commit afc0c8e5 authored by Miranda Fluharty's avatar Miranda Fluharty Committed by Michael Kozono

Use expect_snowplow_event in spec

instead of expect(Gitlab::Tracking).to receive(:event)
parent 8a28ae9b
......@@ -10,5 +10,15 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
before_action -> { authorize_view_by_action!(:read_group_repository_analytics) }
def show
track_event(pageview_tracker_params)
end
private
def pageview_tracker_params
{
label: 'group_id',
value: @group.id
}
end
end
---
title: Track views of group repo analytics page in snowplow
merge_request: 42376
author:
type: added
......@@ -15,7 +15,7 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
stub_licensed_features(feature_name => true)
end
describe 'GET show' do
describe 'GET show', :snowplow do
subject { get :show, params: { group_id: group } }
before do
......@@ -24,6 +24,17 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
specify { is_expected.to have_gitlab_http_status(:success) }
it 'tracks a pageview event in snowplow' do
subject
expect_snowplow_event(
category: 'Groups::Analytics::RepositoryAnalyticsController',
action: 'show',
label: 'group_id',
value: group.id
)
end
context 'when license is missing' do
before do
stub_licensed_features(feature_name => false)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment