From ca6d5f6fd44f181441362d28f092ccb38d5e1390 Mon Sep 17 00:00:00 2001 From: chao-xian Date: Thu, 30 Sep 2021 16:39:02 +0100 Subject: [PATCH] Remove Explore Super Menu AB Test code The test has concluded and all users now get the new header. --- .../ab_tests/explore_menu_ab_testable.rb | 26 ---------- app/controllers/content_items_controller.rb | 15 ------ app/views/layouts/application.html.erb | 2 - .../content_items_controller_test.rb | 7 --- test/controllers/explore_ab_test.rb | 49 ------------------- 5 files changed, 99 deletions(-) delete mode 100644 app/controllers/ab_tests/explore_menu_ab_testable.rb delete mode 100644 test/controllers/explore_ab_test.rb diff --git a/app/controllers/ab_tests/explore_menu_ab_testable.rb b/app/controllers/ab_tests/explore_menu_ab_testable.rb deleted file mode 100644 index a05b3fea8..000000000 --- a/app/controllers/ab_tests/explore_menu_ab_testable.rb +++ /dev/null @@ -1,26 +0,0 @@ -module AbTests::ExploreMenuAbTestable - CUSTOM_DIMENSION = 47 - - ALLOWED_VARIANTS = %w[A B Z].freeze - - def explore_menu_test - @explore_menu_test ||= GovukAbTesting::AbTest.new( - "ExploreMenuAbTestable", - dimension: CUSTOM_DIMENSION, - allowed_variants: ALLOWED_VARIANTS, - control_variant: "Z", - ) - end - - def explore_menu_variant - explore_menu_test.requested_variant(request.headers) - end - - def set_explore_menu_response - explore_menu_variant.configure_response(response) - end - - def explore_menu_variant_b? - explore_menu_variant.variant?("B") - end -end diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index c56c8ad50..da831c83c 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -1,6 +1,4 @@ class ContentItemsController < ApplicationController - include Slimmer::Template - include AbTests::ExploreMenuAbTestable include AbTests::SabPagesTestable rescue_from GdsApi::HTTPForbidden, with: :error_403 @@ -13,11 +11,6 @@ class ContentItemsController < ApplicationController rescue_from PresenterBuilder::SpecialRouteReturned, with: :error_notfound rescue_from PresenterBuilder::GovernmentReturned, with: :error_notfound - before_action :set_explore_menu_response - after_action :set_slimmer_template - - helper_method :explore_menu_variant, :explore_menu_variant_b? - attr_accessor :content_item, :taxonomy_navigation def show @@ -55,14 +48,6 @@ def service_sign_in_options private - def set_slimmer_template - if explore_menu_variant_b? - slimmer_template "core_layout_explore_header" - else - slimmer_template "core_layout" - end - end - def is_history_page? @content_item.document_type == "history" end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 606af6e4a..08da2fd20 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -28,8 +28,6 @@ <% end %> - <%= explore_menu_variant.analytics_meta_tag.html_safe %> - <%= yield :extra_head_content %> diff --git a/test/controllers/content_items_controller_test.rb b/test/controllers/content_items_controller_test.rb index 69fa078a7..1261b4448 100644 --- a/test/controllers/content_items_controller_test.rb +++ b/test/controllers/content_items_controller_test.rb @@ -3,7 +3,6 @@ class ContentItemsControllerTest < ActionController::TestCase include GdsApi::TestHelpers::ContentStore include GovukAbTesting::MinitestHelpers - include AbTests::ExploreMenuAbTestable test "routing handles paths with no format or locale" do assert_routing( @@ -367,12 +366,6 @@ class ContentItemsControllerTest < ActionController::TestCase assert_equal response.headers["Access-Control-Allow-Origin"], "*" end - test "request for Explore navigational super menu from slimmer" do - content_item = content_store_has_schema_example("case_study", "case_study") - get :show, params: { path: path_for(content_item) } - assert_response_not_modified_for_ab_test(AbTests::ExploreMenuAbTestable) - end - def path_for(content_item, locale = nil) base_path = content_item["base_path"].sub(/^\//, "") base_path.gsub!(/\.#{locale}$/, "") if locale diff --git a/test/controllers/explore_ab_test.rb b/test/controllers/explore_ab_test.rb deleted file mode 100644 index 8d3ef691d..000000000 --- a/test/controllers/explore_ab_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require "test_helper" - -class ContentItemsControllerTest < ActionController::TestCase - include GovukAbTesting::MinitestHelpers - - test "shows new header for variant B" do - for_each_schema do |schema| - with_variant ExploreMenuAbTestable: "B" do - set_up_and_visit_content_item_for_schema(schema) - - assert_page_tracked_in_ab_test("ExploreMenuAbTestable", "B", 47) - end - end - end - - test "doesn't show new header for variant A" do - for_each_schema do |schema| - with_variant ExploreMenuAbTestable: "A" do - set_up_and_visit_content_item_for_schema(schema) - - assert_page_tracked_in_ab_test("ExploreMenuAbTestable", "A", 47) - end - end - end - - test "doesn't show new header for variant Z" do - for_each_schema do |schema| - with_variant ExploreMenuAbTestable: "Z" do - set_up_and_visit_content_item_for_schema(schema) - - assert_page_tracked_in_ab_test("ExploreMenuAbTestable", "Z", 47) - end - end - end - -private - - def set_up_and_visit_content_item_for_schema(schema) - content_item = content_store_has_schema_example(schema, schema) - stub_content_store_has_item(content_item["base_path"], content_item) - path = content_item["base_path"][1..] - - get :show, params: { path: path } - end - - def for_each_schema(&block) - %w[guide answer document_collection].each(&block) - end -end