-
Notifications
You must be signed in to change notification settings - Fork 17
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 #3440 from alphagov/fix-govuk-chat-promo-link
Fix GOV.UK Chat promo on pages with multiple path segments
- Loading branch information
Showing
4 changed files
with
25 additions
and
9 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 |
---|---|---|
@@ -1,15 +1,31 @@ | ||
require "test_helper" | ||
|
||
class GovukChatPromoTest < ActionDispatch::IntegrationTest | ||
test "renders GOV.UK chat promo for matching content type and base path" do | ||
test "renders GOV.UK chat promo for matching content type and requested path" do | ||
ClimateControl.modify GOVUK_CHAT_PROMO_ENABLED: "true" do | ||
setup_and_visit_a_page_with_specific_base_path("answer", GovukChatPromoHelper::GOVUK_CHAT_PROMO_BASE_PATHS.first) | ||
setup_and_visit_a_page_with_specific_base_path("guide", "/contracted-out") | ||
|
||
assert page.has_css?(".gem-c-chat-entry") | ||
end | ||
end | ||
|
||
test "renders GOV.UK chat promo when requested path contains multiple parts" do | ||
ClimateControl.modify GOVUK_CHAT_PROMO_ENABLED: "true" do | ||
setup_and_visit_a_page_with_specific_base_path("guide", "/contracted-out/how-contracting-out-affects-your-amount") | ||
|
||
assert page.has_css?(".gem-c-chat-entry") | ||
end | ||
end | ||
|
||
test "does not render GOV.UK chat promo when base path is in allow list but actual path is not" do | ||
ClimateControl.modify GOVUK_CHAT_PROMO_ENABLED: "true" do | ||
setup_and_visit_a_page_with_specific_base_path("guide", "/contracted-out/check-if-you-were-contracted-out") | ||
|
||
assert_not page.has_css?(".gem-c-chat-entry") | ||
end | ||
end | ||
|
||
def schema_type | ||
"answer" | ||
"guide" | ||
end | ||
end |