diff options
Diffstat (limited to 'spec/support/helpers/snowplow_helpers.rb')
-rw-r--r-- | spec/support/helpers/snowplow_helpers.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/support/helpers/snowplow_helpers.rb b/spec/support/helpers/snowplow_helpers.rb index 70a4eadd8de..553739b5d30 100644 --- a/spec/support/helpers/snowplow_helpers.rb +++ b/spec/support/helpers/snowplow_helpers.rb @@ -60,6 +60,10 @@ module SnowplowHelpers .with(category, action, **kwargs).at_least(:once) end + def match_snowplow_context_schema(schema_path:, context:) + expect(context).to match_snowplow_schema(schema_path) + end + # Asserts that no call to `Gitlab::Tracking#event` was made. # # Example: @@ -71,7 +75,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 |