From 0fdcd85d31bc240a36eb1bca1d78a35942a50890 Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Tue, 13 Jan 2026 09:54:25 +0000 Subject: [PATCH] fixup! CLDC-4136: Hide question on UI flow update tests to account --- .../subsections/property_information_spec.rb | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/spec/models/form/lettings/subsections/property_information_spec.rb b/spec/models/form/lettings/subsections/property_information_spec.rb index ed0add494..568e4b028 100644 --- a/spec/models/form/lettings/subsections/property_information_spec.rb +++ b/spec/models/form/lettings/subsections/property_information_spec.rb @@ -15,22 +15,23 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do before do allow(form).to receive(:start_year_2024_or_later?).and_return(true) - allow(form).to receive(:start_year_2025_or_later?).and_return(false) + allow(form).to receive(:start_year_2025_or_later?).and_return(true) + allow(form).to receive(:start_year_2026_or_later?).and_return(true) end - context "when 2023" do - let(:start_date) { Time.utc(2023, 2, 8) } + context "when 2024" do + let(:start_date) { Time.utc(2024, 4, 8) } before do - allow(form).to receive(:start_year_2024_or_later?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2025_or_later?).and_return(false) + allow(form).to receive(:start_year_2026_or_later?).and_return(false) end it "has correct pages" do expect(property_information.pages.map(&:id)).to eq( %w[ - uprn - uprn_confirmation + address_search address property_local_authority local_authority_rent_value_check @@ -38,7 +39,6 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do property_let_type property_vacancy_reason_not_first_let property_vacancy_reason_first_let - property_number_of_times_relet property_unit_type property_building_type property_wheelchair_accessible @@ -51,27 +51,36 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do ], ) end + + context "when it is supported housing and a renewal" do + let(:log) { FactoryBot.build(:lettings_log, needstype: 2, renewal: 1) } + + it "is not displayed in tasklist" do + expect(property_information.displayed_in_tasklist?(log)).to eq(false) + end + end end - context "when 2024" do - let(:start_date) { Time.utc(2024, 2, 8) } + context "when 2025" do + let(:start_date) { Time.utc(2025, 4, 8) } before do allow(form).to receive(:start_year_2024_or_later?).and_return(true) - allow(form).to receive(:start_year_2025_or_later?).and_return(false) + allow(form).to receive(:start_year_2025_or_later?).and_return(true) + allow(form).to receive(:start_year_2026_or_later?).and_return(false) end it "has correct pages" do expect(property_information.pages.map(&:id)).to eq( %w[ - address_search - address - property_local_authority - local_authority_rent_value_check first_time_property_let_as_social_housing property_let_type property_vacancy_reason_not_first_let property_vacancy_reason_first_let + address_search + address + property_local_authority + local_authority_rent_value_check property_unit_type property_building_type property_wheelchair_accessible @@ -81,6 +90,7 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do void_date_value_check property_major_repairs property_major_repairs_value_check + sheltered_accommodation ], ) end @@ -88,23 +98,24 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do context "when it is supported housing and a renewal" do let(:log) { FactoryBot.build(:lettings_log, needstype: 2, renewal: 1) } - it "is not displayed in tasklist" do - expect(property_information.displayed_in_tasklist?(log)).to eq(false) + it "is displayed in tasklist" do + expect(property_information.displayed_in_tasklist?(log)).to eq(true) end end end - context "when 2025" do - let(:start_date) { Time.utc(2025, 2, 8) } + context "when 2026" do + let(:start_date) { Time.utc(2026, 4, 8) } before do allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2025_or_later?).and_return(true) + allow(form).to receive(:start_year_2026_or_later?).and_return(true) end it "has correct pages" do expect(property_information.pages.map(&:id)).to eq( - %w[ + %w[ first_time_property_let_as_social_housing property_let_type property_vacancy_reason_not_first_let @@ -114,7 +125,6 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do property_local_authority local_authority_rent_value_check property_unit_type - property_building_type property_wheelchair_accessible property_number_of_bedrooms beds_rent_value_check @@ -124,15 +134,7 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do property_major_repairs_value_check sheltered_accommodation ], - ) - end - - context "when it is supported housing and a renewal" do - let(:log) { FactoryBot.build(:lettings_log, needstype: 2, renewal: 1) } - - it "is displayed in tasklist" do - expect(property_information.displayed_in_tasklist?(log)).to eq(true) - end + ) end end end