Skip to content

Commit

Permalink
Convert step_navigation tests
Browse files Browse the repository at this point in the history
- rename to remove controller name, since this
  is the same controller as the previous commit
  but a different set of features
  • Loading branch information
KludgeKML committed Jul 1, 2024
1 parent 0f9d2e4 commit dd969b1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 37 deletions.
26 changes: 26 additions & 0 deletions spec/requests/step_navigation_spec.rb
Original file line number Diff line number Diff line change
@@ -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
37 changes: 0 additions & 37 deletions test/controllers/step_navigation_controller_test.rb

This file was deleted.

0 comments on commit dd969b1

Please sign in to comment.