Commit 7698eccf authored by Mark Chao's avatar Mark Chao

Merge branch 'use-webmock-snowplow' into 'master'

Add expect_snowplow_event instead of Gitlab::Tracking

See merge request gitlab-org/gitlab!60807
parents 0584442c 6175fd97
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
RSpec.shared_examples GroupInviteMembers do RSpec.shared_examples GroupInviteMembers do
context 'when inviting members', :snowplow do context 'when inviting members', :snowplow do
before do
allow(Gitlab::Tracking).to receive(:event) # rubocop:disable RSpec/ExpectGitlabTracking
end
context 'without valid emails in the params' do context 'without valid emails in the params' do
it 'no invites generated by default' do it 'no invites generated by default' do
subject subject
...@@ -16,7 +12,7 @@ RSpec.shared_examples GroupInviteMembers do ...@@ -16,7 +12,7 @@ RSpec.shared_examples GroupInviteMembers do
it 'does not track the event' do it 'does not track the event' do
subject subject
expect(Gitlab::Tracking).not_to have_received(:event).with(anything, 'invite_members', label: 'new_group_form') # rubocop:disable RSpec/ExpectGitlabTracking expect_no_snowplow_event(category: anything, action: 'invite_members', label: 'new_group_form')
end end
end end
......
...@@ -71,7 +71,11 @@ module SnowplowHelpers ...@@ -71,7 +71,11 @@ module SnowplowHelpers
# expect_no_snowplow_event # expect_no_snowplow_event
# end # end
# end # end
def expect_no_snowplow_event def expect_no_snowplow_event(category: nil, action: nil, **kwargs)
if category && action
expect(Gitlab::Tracking).not_to have_received(:event).with(category, action, **kwargs) # rubocop:disable RSpec/ExpectGitlabTracking
else
expect(Gitlab::Tracking).not_to have_received(:event) # rubocop:disable RSpec/ExpectGitlabTracking expect(Gitlab::Tracking).not_to have_received(:event) # rubocop:disable RSpec/ExpectGitlabTracking
end end
end
end end
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