summaryrefslogtreecommitdiff
path: root/spec/views/devise/sessions/new.html.haml_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/devise/sessions/new.html.haml_spec.rb')
-rw-r--r--spec/views/devise/sessions/new.html.haml_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/views/devise/sessions/new.html.haml_spec.rb b/spec/views/devise/sessions/new.html.haml_spec.rb
index e8232a2c067..b3cd1493149 100644
--- a/spec/views/devise/sessions/new.html.haml_spec.rb
+++ b/spec/views/devise/sessions/new.html.haml_spec.rb
@@ -63,6 +63,36 @@ RSpec.describe 'devise/sessions/new' do
end
end
+ describe 'Google Tag Manager' do
+ let!(:gtm_id) { 'GTM-WWKMTWS'}
+
+ subject { rendered }
+
+ before do
+ stub_devise
+ disable_captcha
+ stub_config(extra: { google_tag_manager_id: gtm_id, google_tag_manager_nonce_id: gtm_id })
+ end
+
+ describe 'when Google Tag Manager is enabled' do
+ before do
+ enable_gtm
+ render
+ end
+
+ it { is_expected.to match /www.googletagmanager.com/ }
+ end
+
+ describe 'when Google Tag Manager is disabled' do
+ before do
+ disable_gtm
+ render
+ end
+
+ it { is_expected.not_to match /www.googletagmanager.com/ }
+ end
+ end
+
def disable_other_signin_methods
allow(view).to receive(:password_authentication_enabled_for_web?).and_return(false)
allow(view).to receive(:omniauth_enabled?).and_return(false)
@@ -94,4 +124,12 @@ RSpec.describe 'devise/sessions/new' do
allow(view).to receive(:captcha_enabled?).and_return(false)
allow(view).to receive(:captcha_on_login_required?).and_return(false)
end
+
+ def disable_gtm
+ allow(view).to receive(:google_tag_manager_enabled?).and_return(false)
+ end
+
+ def enable_gtm
+ allow(view).to receive(:google_tag_manager_enabled?).and_return(true)
+ end
end