Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 11:27:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-11-19 11:27:35 +0300
commit7e9c479f7de77702622631cff2628a9c8dcbc627 (patch)
treec8f718a08e110ad7e1894510980d2155a6549197 /spec/helpers/auth_helper_spec.rb
parente852b0ae16db4052c1c567d9efa4facc81146e88 (diff)
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/helpers/auth_helper_spec.rb')
-rw-r--r--spec/helpers/auth_helper_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/helpers/auth_helper_spec.rb b/spec/helpers/auth_helper_spec.rb
index e0d316baa17..b4cea7fb695 100644
--- a/spec/helpers/auth_helper_spec.rb
+++ b/spec/helpers/auth_helper_spec.rb
@@ -260,4 +260,41 @@ RSpec.describe AuthHelper do
end
end
end
+
+ describe '#google_tag_manager_enabled?' do
+ let(:is_gitlab_com) { true }
+ let(:user) { nil }
+
+ before do
+ allow(Gitlab).to receive(:com?).and_return(is_gitlab_com)
+ stub_config(extra: { google_tag_manager_id: 'key' })
+ allow(helper).to receive(:current_user).and_return(user)
+ end
+
+ subject(:google_tag_manager_enabled?) { helper.google_tag_manager_enabled? }
+
+ context 'on gitlab.com and a key set without a current user' do
+ it { is_expected.to be_truthy }
+ end
+
+ context 'when not on gitlab.com' do
+ let(:is_gitlab_com) { false }
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when current user is set' do
+ let(:user) { instance_double('User') }
+
+ it { is_expected.to be_falsey }
+ end
+
+ context 'when no key is set' do
+ before do
+ stub_config(extra: {})
+ end
+
+ it { is_expected.to be_falsey }
+ end
+ end
end