diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-06 15:11:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-06 15:11:48 +0000 |
commit | 47d926e838b670f5bfeebab36ddd524f5397c5ca (patch) | |
tree | f0438f24c1ac4acf89009a441761339842ec3b27 /spec/lib/gitlab/tracking | |
parent | 0d1b0d5d03389eea2a4435eea47ec0a37cce9b26 (diff) | |
download | gitlab-ce-47d926e838b670f5bfeebab36ddd524f5397c5ca.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/tracking')
-rw-r--r-- | spec/lib/gitlab/tracking/standard_context_spec.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/lib/gitlab/tracking/standard_context_spec.rb b/spec/lib/gitlab/tracking/standard_context_spec.rb index ca7a6b6b1c3..8ded80dd191 100644 --- a/spec/lib/gitlab/tracking/standard_context_spec.rb +++ b/spec/lib/gitlab/tracking/standard_context_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe Gitlab::Tracking::StandardContext do let_it_be(:project) { create(:project) } let_it_be(:namespace) { create(:namespace) } + let_it_be(:user) { create(:user) } let(:snowplow_context) { subject.to_context } @@ -87,8 +88,8 @@ RSpec.describe Gitlab::Tracking::StandardContext do end end - it 'does not contain user id' do - expect(snowplow_context.to_json[:data].keys).not_to include(:user_id) + it 'contains user id' do + expect(snowplow_context.to_json[:data].keys).to include(:user_id) end it 'contains namespace and project ids' do @@ -104,8 +105,18 @@ RSpec.describe Gitlab::Tracking::StandardContext do stub_feature_flags(add_namespace_and_project_to_snowplow_tracking: false) end - it 'does not contain any ids' do - expect(snowplow_context.to_json[:data].keys).not_to include(:user_id, :project_id, :namespace_id) + it 'does not contain project or namespace ids' do + expect(snowplow_context.to_json[:data].keys).not_to include(:project_id, :namespace_id) + end + end + + context 'without add_actor_based_user_to_snowplow_tracking feature' do + before do + stub_feature_flags(add_actor_based_user_to_snowplow_tracking: false) + end + + it 'does not contain user_id' do + expect(snowplow_context.to_json[:data].keys).not_to include(:user_id) end end end |