-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2711 from alphagov/gtm_component
Conditionally add the GTM component
- Loading branch information
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require "integration_test_helper" | ||
|
||
class GoogleTagManagerComponentTest < ActionDispatch::IntegrationTest | ||
context "GTM environment variables are present" do | ||
should "render the GTM component on the gem_base template" do | ||
ClimateControl.modify GOOGLE_TAG_MANAGER_ID: "a-nice-id" do | ||
visit "/templates/gem_layout.html.erb" | ||
assert_match "https://www.googletagmanager.com/gtm.js", page.body | ||
end | ||
end | ||
end | ||
|
||
context "GTM environment variables are absent" do | ||
should "not render the GTM component on the gem_base template" do | ||
visit "/templates/gem_layout.html.erb" | ||
assert_no_match "https://www.googletagmanager.com/gtm.js", page.body | ||
end | ||
end | ||
end |