Browse Source

CLDC-3133 Remove times offered from 24/25 (#2162)

* feat: remove offered form 24 onwards

* feat: add test

* feat: update test

* refactor: lint
pull/2175/head
natdeanlewissoftwire 9 months ago committed by GitHub
parent
commit
31e5215735
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      app/models/form/lettings/subsections/property_information.rb
  2. 42
      spec/models/form/lettings/subsections/property_information_spec.rb

6
app/models/form/lettings/subsections/property_information.rb

@ -16,7 +16,7 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
Form::Lettings::Pages::PropertyLetType.new(nil, nil, self), Form::Lettings::Pages::PropertyLetType.new(nil, nil, self),
Form::Lettings::Pages::PropertyVacancyReasonNotFirstLet.new(nil, nil, self), Form::Lettings::Pages::PropertyVacancyReasonNotFirstLet.new(nil, nil, self),
Form::Lettings::Pages::PropertyVacancyReasonFirstLet.new(nil, nil, self), Form::Lettings::Pages::PropertyVacancyReasonFirstLet.new(nil, nil, self),
Form::Lettings::Pages::PropertyNumberOfTimesRelet.new(nil, nil, self), number_of_times_relet,
Form::Lettings::Pages::PropertyUnitType.new(nil, nil, self), Form::Lettings::Pages::PropertyUnitType.new(nil, nil, self),
Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self), Form::Lettings::Pages::PropertyBuildingType.new(nil, nil, self),
Form::Lettings::Pages::PropertyWheelchairAccessible.new(nil, nil, self), Form::Lettings::Pages::PropertyWheelchairAccessible.new(nil, nil, self),
@ -44,6 +44,10 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
end end
end end
def number_of_times_relet
Form::Lettings::Pages::PropertyNumberOfTimesRelet.new(nil, nil, self) unless form.start_year_after_2024?
end
def displayed_in_tasklist?(log) def displayed_in_tasklist?(log)
!(log.is_supported_housing? && log.is_renewal?) !(log.is_supported_housing? && log.is_renewal?)
end end

42
spec/models/form/lettings/subsections/property_information_spec.rb

@ -10,7 +10,12 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
end end
describe "pages" do describe "pages" do
let(:section) { instance_double(Form::Sales::Sections::Household, form: instance_double(Form, start_date:)) } let(:section) { instance_double(Form::Sales::Sections::Household, form:) }
let(:form) { instance_double(Form, start_date:) }
before do
allow(form).to receive(:start_year_after_2024?).and_return(false)
end
context "when 2022" do context "when 2022" do
let(:start_date) { Time.utc(2022, 2, 8) } let(:start_date) { Time.utc(2022, 2, 8) }
@ -73,6 +78,41 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
) )
end end
end end
context "when 2024" do
let(:start_date) { Time.utc(2024, 2, 8) }
before do
allow(form).to receive(:start_year_after_2024?).and_return(true)
end
it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq(
%w[
uprn
uprn_confirmation
address
property_local_authority
local_authority_min_rent_value_check
local_authority_max_rent_value_check
first_time_property_let_as_social_housing
property_let_type
property_vacancy_reason_not_first_let
property_vacancy_reason_first_let
property_unit_type
property_building_type
property_wheelchair_accessible
property_number_of_bedrooms
beds_min_rent_value_check
beds_max_rent_value_check
void_date
void_date_value_check
property_major_repairs
property_major_repairs_value_check
],
)
end
end
end end
it "has the correct id" do it "has the correct id" do

Loading…
Cancel
Save