Browse Source

Fix next incomplete section button when first page of next subsection is not routed to

pull/786/head
baarkerlounger 3 years ago
parent
commit
9a6dd196cc
  1. 2
      app/models/form.rb
  2. 2
      spec/models/form_spec.rb

2
app/models/form.rb

@ -79,7 +79,7 @@ class Form
when :in_progress
"#{next_subsection.id}/check_answers".dasherize
when :not_started
first_question_in_subsection = next_subsection.pages.first.id
first_question_in_subsection = next_subsection.pages.find { |page| page.routed_to?(case_log, nil) }.id
first_question_in_subsection.to_s.dasherize
else
"error"

2
spec/models/form_spec.rb

@ -151,7 +151,7 @@ RSpec.describe Form, type: :model do
it "returns the first page of the next incomplete subsection (skipping completed subsections)" do
answer_household_needs(case_log)
expect(form.next_incomplete_section_redirect_path(subsection, case_log)).to eq("accessible-select-too")
expect(form.next_incomplete_section_redirect_path(subsection, case_log)).to eq("property-postcode")
end
it "returns the declaration section for a completed case log" do

Loading…
Cancel
Save