From 232f4edd1ced88398b852197ac32c809bdc5777e Mon Sep 17 00:00:00 2001 From: Arthur Campbell Date: Wed, 8 Mar 2023 15:48:14 +0000 Subject: [PATCH] test the change to the method creating a link to the next subsection --- spec/models/form_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/models/form_spec.rb b/spec/models/form_spec.rb index 57995d90b..42c273ee1 100644 --- a/spec/models/form_spec.rb +++ b/spec/models/form_spec.rb @@ -183,6 +183,26 @@ RSpec.describe Form, type: :model do expect(form.next_incomplete_section_redirect_path(subsection, lettings_log)).to eq("declaration") end end + + context "when no pages or questions in the next subsection are routed to" do + let(:subsection) { form.get_subsection("setup") } + + around do |example| + FormHandler.instance.use_real_forms! + + example.run + + FormHandler.instance.use_fake_forms! + end + + fit "finds the path to the section after" do + lettings_log.startdate = Time.zone.local(2022, 9, 1) + lettings_log.renewal = 1 + lettings_log.needstype = 2 + lettings_log.postcode_known = 0 + expect(form.next_incomplete_section_redirect_path(subsection, lettings_log)).to eq("joint") + end + end end describe "invalidated_page_questions" do