From d38dde64fbde6bc52437018760f0c6e423aa98c7 Mon Sep 17 00:00:00 2001 From: Aga Dufrat Date: Tue, 16 Aug 2022 12:10:59 +0100 Subject: [PATCH] Remove Tree test survey recruitment banners --- .../content_item/recruitment_banner.rb | 25 +------------ test/integration/recruitment_banner_test.rb | 35 ------------------- 2 files changed, 1 insertion(+), 59 deletions(-) diff --git a/app/presenters/content_item/recruitment_banner.rb b/app/presenters/content_item/recruitment_banner.rb index 6dd41055c..d6e90d3f6 100644 --- a/app/presenters/content_item/recruitment_banner.rb +++ b/app/presenters/content_item/recruitment_banner.rb @@ -1,9 +1,5 @@ module ContentItem module RecruitmentBanner - TREE_TEST_URL = "https://GDSUserResearch.optimalworkshop.com/treejack/8f1yr1fj".freeze - TREE_TEST_PAGE = "/browse/working".freeze - TREE_TEST_MAPPINGS = { TREE_TEST_PAGE => TREE_TEST_URL }.freeze - VISA_TEST_URL = "https://surveys.publishing.service.gov.uk/s/0DZCPX/".freeze VISA_TEST_MAPPINGS = { "/apply-to-come-to-the-uk" => VISA_TEST_URL, @@ -22,31 +18,12 @@ module RecruitmentBanner }.freeze def recruitment_survey_url - tree_test_url || visa_test_url - end - - def tree_test_url - key = TREE_TEST_MAPPINGS.keys.find { |k| content_tagged_to(k).present? } - TREE_TEST_MAPPINGS[key] + visa_test_url end def visa_test_url key = content_item["base_path"] VISA_TEST_MAPPINGS[key] end - - private - - def mainstream_browse_pages - content_item["links"]["mainstream_browse_pages"] if content_item["links"] - end - - def content_tagged_to(browse_base_path) - return [] unless mainstream_browse_pages - - mainstream_browse_pages.find do |mainstream_browse_page| - mainstream_browse_page["base_path"].starts_with? browse_base_path - end - end end end diff --git a/test/integration/recruitment_banner_test.rb b/test/integration/recruitment_banner_test.rb index 2608b63a8..867eecfc7 100644 --- a/test/integration/recruitment_banner_test.rb +++ b/test/integration/recruitment_banner_test.rb @@ -1,41 +1,6 @@ require "test_helper" class RecruitmentBannerTest < ActionDispatch::IntegrationTest - test "Tree test recruitment banner is displayed for any page tagged to Working, jobs and pensions" do - @working_browse_page = { - "content_id" => "123", - "title" => "Self Assessment", - "base_path" => "/browse/working/self-assessment", - } - - guide = GovukSchemas::Example.find("guide", example_name: "guide") - guide["links"]["mainstream_browse_pages"] = [] - guide["links"]["mainstream_browse_pages"] << @working_browse_page - - stub_content_store_has_item(guide["base_path"], guide.to_json) - visit guide["base_path"] - - assert page.has_css?(".gem-c-intervention") - assert page.has_link?("Take part in user research (opens in a new tab)", href: "https://GDSUserResearch.optimalworkshop.com/treejack/8f1yr1fj") - end - - test "Tree test recruitment banner is not displayed unless page is tagged to a topic of interest" do - @not_of_interest = { - "content_id" => "123", - "title" => "I am not interesting", - "base_path" => "/browse/boring", - } - - guide = GovukSchemas::Example.find("guide", example_name: "guide") - guide["links"]["mainstream_browse_pages"] = [] - guide["links"]["mainstream_browse_pages"] << @not_of_interest - stub_content_store_has_item(guide["base_path"], guide.to_json) - visit_with_cachebust guide["base_path"] - - assert_not page.has_css?(".gem-c-intervention") - assert_not page.has_link?("Take part in user research", href: "https://GDSUserResearch.optimalworkshop.com/treejack/8f1yr1fj") - end - test "Visa test recruitment banner is displayed on pages of interest" do guide = GovukSchemas::Example.find("guide", example_name: "guide")