diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-29 15:09:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-29 15:09:58 +0300 |
commit | c6c658b674a37d73ba2f7d8e5808fe4d67d09919 (patch) | |
tree | 0ae67c5edafdb76680d04c1483f3d205c3763014 /spec | |
parent | 6d89885501262fc2c4293f70b11c3a134f7cc37c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/experiments/application_experiment_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/tracking_spec.rb | 20 |
2 files changed, 26 insertions, 6 deletions
diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb index 20050fae1cb..b144e6f77d2 100644 --- a/spec/experiments/application_experiment_spec.rb +++ b/spec/experiments/application_experiment_spec.rb @@ -129,7 +129,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, property: '_property_', context: [ { @@ -162,7 +162,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, user: user, project: project, namespace: namespace, @@ -177,7 +177,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, user: user, project: project, namespace: group, @@ -193,7 +193,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, user: actor, project: project, namespace: namespace, @@ -208,7 +208,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, project: project, namespace: namespace, context: an_instance_of(Array) @@ -297,7 +297,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect(Gitlab::Tracking).to have_received(:event).with( # rubocop:disable RSpec/ExpectGitlabTracking 'top', - 'nested', + :nested, hash_including(label: 'nested') ) end diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index 7f30d794aee..e11175c776d 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -145,6 +145,26 @@ RSpec.describe Gitlab::Tracking do end end + context 'when the action is not passed in as a string' do + it 'allows symbols' do + expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception) + + described_class.event('category', :some_action) + end + + it 'allows nil' do + expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception) + + described_class.event('category', nil) + end + + it 'allows integers' do + expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception) + + described_class.event('category', 1) + end + end + context 'when destination is Snowplow' do before do allow(Rails.env).to receive(:development?).and_return(true) |