diff options
Diffstat (limited to 'spec/support/helpers/snowplow_helpers.rb')
-rw-r--r-- | spec/support/helpers/snowplow_helpers.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/support/helpers/snowplow_helpers.rb b/spec/support/helpers/snowplow_helpers.rb index 70a4eadd8de..a6de8dabdac 100644 --- a/spec/support/helpers/snowplow_helpers.rb +++ b/spec/support/helpers/snowplow_helpers.rb @@ -46,7 +46,7 @@ module SnowplowHelpers # } # ] # ) - def expect_snowplow_event(category:, action:, context: nil, **kwargs) + def expect_snowplow_event(category:, action:, context: nil, standard_context: nil, **kwargs) if context kwargs[:context] = [] context.each do |c| @@ -56,6 +56,14 @@ module SnowplowHelpers end end + if standard_context + expect(Gitlab::Tracking::StandardContext) + .to have_received(:new) + .with(**standard_context) + + kwargs[:standard_context] = an_instance_of(Gitlab::Tracking::StandardContext) + end + expect(Gitlab::Tracking).to have_received(:event) # rubocop:disable RSpec/ExpectGitlabTracking .with(category, action, **kwargs).at_least(:once) end |