From 0875c55c6e1f25e829dfb7aa72b98fac7621d5ca Mon Sep 17 00:00:00 2001 From: David May-Miller Date: Wed, 18 Oct 2023 11:26:46 +0100 Subject: [PATCH] CLDC-2882 Changed void date routing to only use isRenewal (#1982) * CLDC-2882 Added 20 "Tenant moved to long-stay hospital or similar institution" as a non-renewal or first let vacancy reason, and changed the conditions for the void date to only rely on whether a letting is a renewal. * CLDC-2882 Update void date routing test * CLDC-2882 Fix flaky log export test --- app/models/form/lettings/pages/void_date.rb | 3 +-- app/models/lettings_log.rb | 2 +- spec/models/form/lettings/pages/void_date_spec.rb | 2 +- spec/services/exports/lettings_log_export_service_spec.rb | 3 ++- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/form/lettings/pages/void_date.rb b/app/models/form/lettings/pages/void_date.rb index 43d066a70..5ba80d41e 100644 --- a/app/models/form/lettings/pages/void_date.rb +++ b/app/models/form/lettings/pages/void_date.rb @@ -2,8 +2,7 @@ class Form::Lettings::Pages::VoidDate < ::Form::Page def initialize(id, hsh, subsection) super @id = "void_date" - @depends_on = [{ "is_renewal?" => false, "vacancy_reason_not_renewal_or_first_let?" => true }, - { "is_renewal?" => false, "has_first_let_vacancy_reason?" => true }] + @depends_on = [{ "is_renewal?" => false }] end def questions diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index 66d894e3b..d9712ea52 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -338,7 +338,7 @@ class LettingsLog < Log end def vacancy_reason_not_renewal_or_first_let? - [5, 6, 8, 9, 10, 11, 12, 13, 18, 19].include? rsnvac + [5, 6, 8, 9, 10, 11, 12, 13, 18, 19, 20].include? rsnvac end def previous_tenancy_was_temporary? diff --git a/spec/models/form/lettings/pages/void_date_spec.rb b/spec/models/form/lettings/pages/void_date_spec.rb index 7a4b394d4..c2eb8004a 100644 --- a/spec/models/form/lettings/pages/void_date_spec.rb +++ b/spec/models/form/lettings/pages/void_date_spec.rb @@ -28,6 +28,6 @@ RSpec.describe Form::Lettings::Pages::VoidDate, type: :model do end it "has the correct depends_on" do - expect(page.depends_on).to eq([{ "is_renewal?" => false, "vacancy_reason_not_renewal_or_first_let?" => true }, { "has_first_let_vacancy_reason?" => true, "is_renewal?" => false }]) + expect(page.depends_on).to eq([{ "is_renewal?" => false }]) end end diff --git a/spec/services/exports/lettings_log_export_service_spec.rb b/spec/services/exports/lettings_log_export_service_spec.rb index a5e41dfd3..790995c9e 100644 --- a/spec/services/exports/lettings_log_export_service_spec.rb +++ b/spec/services/exports/lettings_log_export_service_spec.rb @@ -33,7 +33,8 @@ RSpec.describe Exports::LettingsLogExportService do end before do - Timecop.travel(start_time) + Timecop.freeze(start_time) + Singleton.__init__(FormHandler) allow(storage_service).to receive(:write_file) # Stub the form handler to use the real form