Skip to content

Commit

Permalink
Revert "Add AB test for Contents list"
Browse files Browse the repository at this point in the history
This reverts commit 731b245.
  • Loading branch information
unoduetre committed Feb 26, 2025
1 parent 47a9fd6 commit 7148f19
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 115 deletions.
10 changes: 0 additions & 10 deletions app/controllers/content_items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require "slimmer/headers"

class ContentItemsController < ApplicationController
include ContentsListAbTestable
include GovukPersonalisation::ControllerConcern
include Slimmer::Headers
include Slimmer::Template
Expand All @@ -16,9 +15,6 @@ class ContentItemsController < ApplicationController
rescue_from PresenterBuilder::SpecialRouteReturned, with: :error_notfound
rescue_from PresenterBuilder::GovernmentReturned, with: :error_notfound

helper_method :contents_list_variant
helper_method :step_by_step_page_under_test?

attr_accessor :content_item, :taxonomy_navigation

content_security_policy do |p|
Expand All @@ -36,10 +32,6 @@ def show
elsif is_history_page?
show_history_page
else
if step_by_step_page_under_test?
set_contents_list_response_header
end

set_guide_draft_access_token if @content_item.is_a?(GuidePresenter)
render_template
end
Expand All @@ -65,8 +57,6 @@ def service_sign_in_options

private

helper_method :show_contents_list_ab_test?

def is_history_page?
@content_item.document_type == "history"
end
Expand Down
61 changes: 0 additions & 61 deletions app/helpers/contents_list_ab_testable.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/views/content_items/guide.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
canonical_url: @content_item.canonical_url,
body: @content_item.has_parts? ? @content_item.current_part_body : nil
) %>
<%= contents_list_variant.analytics_meta_tag.html_safe if step_by_step_page_under_test? %>

<%= @requested_variant.analytics_meta_tag.html_safe if @requested_variant.present? %>
<% end %>

Expand All @@ -25,7 +25,7 @@
font_size: "xl",
margin_bottom: 8
} %>
<% if show_contents_list_ab_test? || @content_item.show_guide_navigation? %>
<% if @content_item.show_guide_navigation? %>
<%= render "govuk_publishing_components/components/skip_link", {
text: t("guide.skip_contents"),
href: "#guide-contents"
Expand Down
42 changes: 0 additions & 42 deletions test/controllers/content_items_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,48 +368,6 @@ class ContentItemsControllerTest < ActionController::TestCase
assert_equal "true", @response.headers[Slimmer::Headers::REMOVE_SEARCH_HEADER]
end

test "Contents List AB test variant A" do
content_item = content_store_has_schema_example("guide", "guide-with-step-navs")
content_item["base_path"] = "/help-with-childcare-costs/support-while-you-study"
content_item["details"]["hide_chapter_navigation"] = true

stub_content_store_has_item(content_item["base_path"], content_item)

with_variant ContentsList: "A" do
get :show, params: { path: "help-with-childcare-costs/support-while-you-study" }
assert_response :success
assert_not response.body.include?("contents-list")
end
end

test "Contents List AB test variant B" do
content_item = content_store_has_schema_example("guide", "guide-with-step-navs")
content_item["base_path"] = "/help-with-childcare-costs/support-while-you-study"
content_item["details"]["hide_chapter_navigation"] = true

stub_content_store_has_item(content_item["base_path"], content_item)

with_variant ContentsList: "B" do
get :show, params: { path: "help-with-childcare-costs/support-while-you-study" }
assert_response :success
assert response.body.include?("contents-list")
end
end

test "Contents List AB test variant Z" do
content_item = content_store_has_schema_example("guide", "guide-with-step-navs")
content_item["base_path"] = "/help-with-childcare-costs/support-while-you-study"
content_item["details"]["hide_chapter_navigation"] = true

stub_content_store_has_item(content_item["base_path"], content_item)

with_variant ContentsList: "Z" do
get :show, params: { path: "help-with-childcare-costs/support-while-you-study" }
assert_response :success
assert_not response.body.include?("contents-list")
end
end

def path_for(content_item, locale = nil)
base_path = content_item["base_path"].sub(/^\//, "")
base_path.gsub!(/\.#{locale}$/, "") if locale
Expand Down

0 comments on commit 7148f19

Please sign in to comment.