Commit 6175fd97 authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Mark Chao

Use expect_no_snowplow_event (updated to accept args)

Check for category and action to be nil
parent 674f3cd5
......@@ -2,10 +2,6 @@
RSpec.shared_examples GroupInviteMembers 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
it 'no invites generated by default' do
subject
......@@ -16,7 +12,7 @@ RSpec.shared_examples GroupInviteMembers do
it 'does not track the event' do
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
......
......@@ -71,7 +71,11 @@ module SnowplowHelpers
# expect_no_snowplow_event
# end
# end
def expect_no_snowplow_event
expect(Gitlab::Tracking).not_to have_received(:event) # rubocop:disable RSpec/ExpectGitlabTracking
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
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