From da2721531940b5ec722aaed300f755879191472a Mon Sep 17 00:00:00 2001 From: Keith Lawrence Date: Mon, 1 Jul 2024 14:52:06 +0100 Subject: [PATCH] Convert step_navigation tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rename to remove controller name, since this ∙ is the same controller as the previous commit ∙ but a different set of features --- spec/requests/step_navigation_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/requests/step_navigation_spec.rb diff --git a/spec/requests/step_navigation_spec.rb b/spec/requests/step_navigation_spec.rb new file mode 100644 index 0000000000..fe81aeb282 --- /dev/null +++ b/spec/requests/step_navigation_spec.rb @@ -0,0 +1,26 @@ +RSpec.describe("Step Navigation", type: :request) do + %w[guide answer publication].each do |schema_name| + it "#{schema_name} shows step by step navigation where relevant" do + content_item = content_store_has_schema_example(schema_name, "#{schema_name}-with-step-navs") + content_item["base_path"] = "/pass-plus" + stub_content_store_has_item(content_item["base_path"], content_item) + allow_any_instance_of(ContentItemsController).to receive(:page_in_scope?).and_return(false) + get content_item["base_path"] + + expect(response.status).to eq(200) + expect(response.body).to include("Learn to drive a car: step by step") + end + + it "#{schema_name} does not show step by step navigation where relevant" do + content_item = content_store_has_schema_example(schema_name, schema_name) + content_item["base_path"] = "/not-part-of-a-step-by-step" + stub_content_store_has_item(content_item["base_path"], content_item) + allow_any_instance_of(ContentItemsController).to receive(:page_in_scope?).and_return(false) + + get content_item["base_path"] + + expect(response.status).to eq(200) + expect(response.body).not_to include("Learn to drive a car: step by step") + end + end +end