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 83a5b7e48bc..3bde01c6fbf 100644 --- a/spec/support/helpers/snowplow_helpers.rb +++ b/spec/support/helpers/snowplow_helpers.rb @@ -32,8 +32,16 @@ module SnowplowHelpers # end # end def expect_snowplow_event(category:, action:, **kwargs) - expect(Gitlab::Tracking).to have_received(:event) - .with(category, action, **kwargs).at_least(:once) + # This check will no longer be needed with Ruby 2.7 which + # would not pass any arguments when using **kwargs. + # https://gitlab.com/gitlab-org/gitlab/-/issues/263430 + if kwargs.present? + expect(Gitlab::Tracking).to have_received(:event) + .with(category, action, **kwargs).at_least(:once) + else + expect(Gitlab::Tracking).to have_received(:event) + .with(category, action).at_least(:once) + end end # Asserts that no call to `Gitlab::Tracking#event` was made. |