From 7f38e1bc621a9c7c147282dac8d9bac5698cde27 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:28:19 +0000 Subject: [PATCH] Sales remove question 9 --- app/models/form/sales/subsections/setup.rb | 2 +- config/locales/forms/2025/sales/setup.en.yml | 6 ---- .../form/sales/subsections/setup_spec.rb | 34 ++++++++++++++++++- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index de623e769..ec343f71f 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -16,7 +16,7 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection Form::Sales::Pages::SharedOwnershipType.new(nil, nil, self), Form::Sales::Pages::DiscountedOwnershipType.new(nil, nil, self), Form::Sales::Pages::OutrightOwnershipType.new(nil, nil, self), - Form::Sales::Pages::BuyerCompany.new(nil, nil, self), + (Form::Sales::Pages::BuyerCompany.new(nil, nil, self) unless form.start_year_2025_or_later?), Form::Sales::Pages::BuyerLive.new(nil, nil, self), Form::Sales::Pages::JointPurchase.new(nil, nil, self), Form::Sales::Pages::NumberJointBuyers.new(nil, nil, self), diff --git a/config/locales/forms/2025/sales/setup.en.yml b/config/locales/forms/2025/sales/setup.en.yml index 4f00ab0c2..6b3fbf12b 100644 --- a/config/locales/forms/2025/sales/setup.en.yml +++ b/config/locales/forms/2025/sales/setup.en.yml @@ -61,12 +61,6 @@ en: hint_text: "" question_text: "What type of sale is it?" - companybuy: - page_header: "" - check_answer_label: "Company buyer" - hint_text: "" - question_text: "Is the buyer a company?" - buylivein: page_header: "" check_answer_label: "Buyers living in property" diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index 70d52977f..5ff389b15 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/spec/models/form/sales/subsections/setup_spec.rb @@ -23,6 +23,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do context "when start year is before 2024" do before do allow(section.form).to receive(:start_year_2024_or_later?).and_return(false) + allow(section.form).to receive(:start_year_2025_or_later?).and_return(false) end it "has correct pages" do @@ -46,9 +47,10 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do end end - context "when start year is >= 2024" do + context "when start year is 2024" do before do allow(section.form).to receive(:start_year_2024_or_later?).and_return(true) + allow(section.form).to receive(:start_year_2025_or_later?).and_return(false) end it "has correct pages" do @@ -75,4 +77,34 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do ) end end + + context "when start year is >= 2025" do + before do + allow(section.form).to receive(:start_year_2024_or_later?).and_return(true) + allow(section.form).to receive(:start_year_2025_or_later?).and_return(true) + end + + it "has correct pages" do + expect(setup.pages.map(&:id)).to eq( + %w[ + owning_organisation + managing_organisation + assigned_to + completion_date + purchaser_code + ownership_scheme + shared_ownership_type + discounted_ownership_type + outright_ownership_type + buyer_live + joint_purchase + number_joint_buyers + buyer_interview_joint_purchase + buyer_interview + privacy_notice_joint_purchase + privacy_notice + ], + ) + end + end end