From 7d407ab4c6abd35e1f657fc658669b0a463a1cfe Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 13 Nov 2024 11:49:56 +0000 Subject: [PATCH] CLDC-3739: Remove buyer orgs question from 2025 (#2766) --- .../form/sales/subsections/household_situation.rb | 14 +++----------- .../forms/2025/sales/household_situation.en.yml | 6 ------ .../sales/subsections/household_situation_spec.rb | 14 ++++++++------ 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/app/models/form/sales/subsections/household_situation.rb b/app/models/form/sales/subsections/household_situation.rb index 225b1ae43..2e496908b 100644 --- a/app/models/form/sales/subsections/household_situation.rb +++ b/app/models/form/sales/subsections/household_situation.rb @@ -11,17 +11,9 @@ class Form::Sales::Subsections::HouseholdSituation < ::Form::Subsection Form::Sales::Pages::Buyer1PreviousTenure.new(nil, nil, self), Form::Sales::Pages::LastAccommodation.new(nil, nil, self), Form::Sales::Pages::LastAccommodationLa.new(nil, nil, self), - Form::Sales::Pages::BuyersOrganisations.new(nil, nil, self), - buyer_2_situation_pages, + (Form::Sales::Pages::BuyersOrganisations.new(nil, nil, self) unless form.start_year_2025_or_later?), + Form::Sales::Pages::Buyer2LivingIn.new(nil, nil, self), + Form::Sales::Pages::Buyer2PreviousHousingSituation.new(nil, nil, self), ].flatten.compact end - - def buyer_2_situation_pages - if form.start_date.year >= 2023 - [ - Form::Sales::Pages::Buyer2LivingIn.new(nil, nil, self), - Form::Sales::Pages::Buyer2PreviousHousingSituation.new(nil, nil, self), - ] - end - end end diff --git a/config/locales/forms/2025/sales/household_situation.en.yml b/config/locales/forms/2025/sales/household_situation.en.yml index 3aa3545d8..6b49a7d37 100644 --- a/config/locales/forms/2025/sales/household_situation.en.yml +++ b/config/locales/forms/2025/sales/household_situation.en.yml @@ -31,12 +31,6 @@ en: hint_text: "" question_text: "Select a local authority" - buyers_organisations: - page_header: "" - check_answer_label: "Organisations buyers were registered with" - hint_text: "Select all that apply. This question is optional. If no options are applicable, leave the options blank, and select save and continue." - question_text: "What organisations were the buyers registered with?" - buy2living: page_header: "" check_answer_label: "Buyer 2 living at the same address" diff --git a/spec/models/form/sales/subsections/household_situation_spec.rb b/spec/models/form/sales/subsections/household_situation_spec.rb index 10898b27c..903960a8d 100644 --- a/spec/models/form/sales/subsections/household_situation_spec.rb +++ b/spec/models/form/sales/subsections/household_situation_spec.rb @@ -3,16 +3,15 @@ require "rails_helper" RSpec.describe Form::Sales::Subsections::HouseholdSituation, type: :model do subject(:household_characteristics) { described_class.new(nil, nil, section) } - let(:start_date) { Time.utc(2023, 4, 1) } - let(:form) { instance_double(Form, start_date:) } + let(:form) { instance_double(Form, start_year_2024_or_later?: true, start_year_2025_or_later?: false) } let(:section) { instance_double(Form::Sales::Sections::Household, form:) } it "has correct section" do expect(household_characteristics.section).to eq(section) end - context "when the log belongs to the 22/23 collection" do - let(:start_date) { Time.utc(2022, 4, 1) } + context "when the start year is 2024" do + let(:form) { instance_double(Form, start_year_2024_or_later?: true, start_year_2025_or_later?: false) } it "has correct pages" do expect(household_characteristics.pages.map(&:id)).to eq( @@ -21,19 +20,22 @@ RSpec.describe Form::Sales::Subsections::HouseholdSituation, type: :model do last_accommodation last_accommodation_la buyers_organisations + buyer_2_living_in + buyer_2_previous_housing_situation ], ) end end - context "when the log belongs to the 23/24 collection" do + context "when the start year is 2025" do + let(:form) { instance_double(Form, start_year_2024_or_later?: true, start_year_2025_or_later?: true) } + it "has correct pages" do expect(household_characteristics.pages.map(&:id)).to eq( %w[ buyer1_previous_tenure last_accommodation last_accommodation_la - buyers_organisations buyer_2_living_in buyer_2_previous_housing_situation ],