diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/services/event_create_service_spec.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/services/event_create_service_spec.rb')
-rw-r--r-- | spec/services/event_create_service_spec.rb | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/spec/services/event_create_service_spec.rb b/spec/services/event_create_service_spec.rb index 611e821f3e5..c22099fe410 100644 --- a/spec/services/event_create_service_spec.rb +++ b/spec/services/event_create_service_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redis_shared_state do + include SnowplowHelpers + let(:service) { described_class.new } let_it_be(:user, reload: true) { create :user } @@ -18,6 +20,28 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi end end + shared_examples 'Snowplow event' do + it 'is not emitted if FF is disabled' do + stub_feature_flags(route_hll_to_snowplow: false) + + subject + + expect_no_snowplow_event + end + + it 'is emitted' do + subject + + expect_snowplow_event( + category: described_class.to_s, + action: 'action_active_users_project_repo', + namespace: project.namespace, + user: user, + project: project + ) + end + end + describe 'Issues' do describe '#open_issue' do let(:issue) { create(:issue) } @@ -247,7 +271,7 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi end end - describe '#push' do + describe '#push', :snowplow do let(:push_data) do { commits: [ @@ -270,9 +294,11 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi it_behaves_like "it records the event in the event counter" do let(:event_action) { Gitlab::UsageDataCounters::TrackUniqueEvents::PUSH_ACTION } end + + it_behaves_like 'Snowplow event' end - describe '#bulk_push' do + describe '#bulk_push', :snowplow do let(:push_data) do { action: :created, @@ -288,6 +314,8 @@ RSpec.describe EventCreateService, :clean_gitlab_redis_cache, :clean_gitlab_redi it_behaves_like "it records the event in the event counter" do let(:event_action) { Gitlab::UsageDataCounters::TrackUniqueEvents::PUSH_ACTION } end + + it_behaves_like 'Snowplow event' end describe 'Project' do |