diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-17 12:08:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-17 12:08:04 +0300 |
commit | f4cab593243c89a6e22a546d253a546e0d1174af (patch) | |
tree | 84e195ef03fa8c4e2e2242d55b3822956f852fe9 /spec/lib | |
parent | 172e4a12748fd146fdd0e9eca12ade4c51dabda9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/internal_events_spec.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/lib/gitlab/internal_events_spec.rb b/spec/lib/gitlab/internal_events_spec.rb index 7ac583b24ce..4e475cf9a1d 100644 --- a/spec/lib/gitlab/internal_events_spec.rb +++ b/spec/lib/gitlab/internal_events_spec.rb @@ -51,8 +51,8 @@ RSpec.describe Gitlab::InternalEvents, :snowplow, feature_category: :product_ana expect(SnowplowTracker::SelfDescribingJson).to have_received(:new) .with(service_ping_context[:schema], service_ping_context[:data]).at_least(:once) - expect(fake_snowplow).to have_received(:event) do |category, provided_event_name, args| - expect(category).to eq('InternalEventTracking') + expect(fake_snowplow).to have_received(:event) do |provided_category, provided_event_name, args| + expect(provided_category).to eq(category) expect(provided_event_name).to eq(event_name) contexts = args[:context]&.map(&:to_json) @@ -92,6 +92,7 @@ RSpec.describe Gitlab::InternalEvents, :snowplow, feature_category: :product_ana let(:redis) { instance_double('Redis') } let(:fake_snowplow) { instance_double(Gitlab::Tracking::Destinations::Snowplow) } let(:event_name) { 'g_edit_by_web_ide' } + let(:category) { 'InternalEventTracking' } let(:unique_property) { :user } let(:unique_value) { user.id } let(:redis_arguments) { [event_name, Date.today.strftime('%G-%V')] } @@ -134,6 +135,16 @@ RSpec.describe Gitlab::InternalEvents, :snowplow, feature_category: :product_ana end end + context 'when category is passed' do + let(:category) { 'SomeCategory' } + + it 'is sent to Snowplow' do + described_class.track_event(event_name, category: category, user: user, project: project) + + expect_snowplow_tracking + end + end + context 'when arguments are invalid' do context 'when user is not an instance of User' do let(:user) { 'a_string' } |