Skip to content

Commit

Permalink
Fix skipped tests
Browse files Browse the repository at this point in the history
I think there were a couple of issues: using the incorrect fixture,
and needing to add the placeholder string to the parts key
  • Loading branch information
hannako committed Dec 22, 2023
1 parent a922eb7 commit 547ed99
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions test/controllers/content_items_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ class ContentItemsControllerTest < ActionController::TestCase
content_item["details"]["body"] = "{{ab_test_sa_video_stop_self_employed}}"

stub_content_store_has_item(content_item["base_path"], content_item)

request.headers["HTTP_GOVUK_ABTEST_SAVIDEOSTOPSELFEMPLOYED"] = nil

get :show, params: { path: path_for(content_item) }
Expand Down Expand Up @@ -500,10 +499,15 @@ class ContentItemsControllerTest < ActionController::TestCase
end

test "AB test replaces content on the pay-weekly-monthly page with default" do
skip("Needs fixing")
content_item = content_store_has_schema_example("answer", "answer")
content_item["base_path"] = "/pay-self-assessment-tax-bill/pay-weekly-monthly"
content_item["details"]["body"] = "{{ab_test_sa_video_pay_bill}}"
# skip("Needs fixing")
content_item = govuk_content_schema_example("guide", "guide")
content_item["base_path"] = "/pay-self-assessment-tax-bill"
content_item["details"]["parts"] = []
parts = {
"body" => "{{ab_test_sa_video_pay_bill}}",
"slug" => "pay-weekly-monthly",
}
content_item["details"]["parts"] << parts

stub_content_store_has_item(content_item["base_path"], content_item)

Expand All @@ -516,10 +520,15 @@ class ContentItemsControllerTest < ActionController::TestCase
end

test "AB test replaces content on the pay-weekly-monthly page with Variant A" do
skip("Needs fixing")
content_item = content_store_has_schema_example("answer", "answer")
content_item["base_path"] = "/pay-self-assessment-tax-bill/pay-weekly-monthly"
content_item["details"]["body"] = "{{ab_test_sa_video_pay_bill}}"
# skip("Needs fixing")
content_item = govuk_content_schema_example("guide", "guide")
content_item["base_path"] = "/pay-self-assessment-tax-bill"
content_item["details"]["parts"] = []
parts = {
"body" => "{{ab_test_sa_video_pay_bill}}",
"slug" => "pay-weekly-monthly",
}
content_item["details"]["parts"] << parts

stub_content_store_has_item(content_item["base_path"], content_item)

Expand All @@ -532,20 +541,23 @@ class ContentItemsControllerTest < ActionController::TestCase
end

test "AB test replaces content on the pay-weekly-monthly page with Variant B" do
skip("Needs fixing")
content_item = content_store_has_schema_example("guide", "guide")
# skip("Needs fixing")
content_item = govuk_content_schema_example("guide", "guide")
content_item["base_path"] = "/pay-self-assessment-tax-bill"
content_item["details"]["body"] = "{{ab_test_sa_video_pay_bill}}"
content_item["current_part_body"] = "{{ab_test_sa_video_pay_bill}}"
content_item["details"]["parts"] = []
parts = {
"body" => "{{ab_test_sa_video_pay_bill}}",
"slug" => "pay-weekly-monthly",
}
content_item["details"]["parts"] << parts

stub_content_store_has_item(content_item["base_path"], content_item)

request.headers["HTTP_GOVUK_ABTEST_SAVIDEOPAYBILL"] = "B"

get :show, params: { path: path_for(content_item) }
assert_response :success
assert_no_match "{{ab_test_sa_video_pay_bill}}", response.body
assert_includes I18n.t("ab_tests.sa_video_pay_bill.B").to_s, response.body
assert_match I18n.t("ab_tests.sa_video_pay_bill.B").to_s, response.body
end

def path_for(content_item, locale = nil)
Expand Down

0 comments on commit 547ed99

Please sign in to comment.