Browse Source

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
pull/1991/head
David May-Miller 1 year ago committed by GitHub
parent
commit
0875c55c6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/models/form/lettings/pages/void_date.rb
  2. 2
      app/models/lettings_log.rb
  3. 2
      spec/models/form/lettings/pages/void_date_spec.rb
  4. 3
      spec/services/exports/lettings_log_export_service_spec.rb

3
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

2
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?

2
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

3
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

Loading…
Cancel
Save