From 2e279d251daa8506cd6802b62423ef44a4372dd3 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:14:51 +0000 Subject: [PATCH] CLDC-1976 remove duplicate purchase price page (#1324) * feat: remove duplicated purchase price page and delete as it's not used elsewhere * test: update * feat: update * db: update --- app/models/form/sales/pages/purchase_price.rb | 14 -------- .../discounted_ownership_scheme.rb | 1 - .../form/sales/pages/purchase_price_spec.rb | 35 ------------------- .../discounted_ownership_scheme_spec.rb | 1 - spec/models/form_handler_spec.rb | 4 +-- 5 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 app/models/form/sales/pages/purchase_price.rb delete mode 100644 spec/models/form/sales/pages/purchase_price_spec.rb diff --git a/app/models/form/sales/pages/purchase_price.rb b/app/models/form/sales/pages/purchase_price.rb deleted file mode 100644 index af13fc682..000000000 --- a/app/models/form/sales/pages/purchase_price.rb +++ /dev/null @@ -1,14 +0,0 @@ -class Form::Sales::Pages::PurchasePrice < ::Form::Page - def initialize(id, hsh, subsection) - super - @depends_on = [ - { "ownershipsch" => 2, "rent_to_buy_full_ownership?" => false }, - ] - end - - def questions - @questions ||= [ - Form::Sales::Questions::PurchasePrice.new(nil, nil, self), - ] - end -end diff --git a/app/models/form/sales/subsections/discounted_ownership_scheme.rb b/app/models/form/sales/subsections/discounted_ownership_scheme.rb index 499411ffc..74e408cfd 100644 --- a/app/models/form/sales/subsections/discounted_ownership_scheme.rb +++ b/app/models/form/sales/subsections/discounted_ownership_scheme.rb @@ -13,7 +13,6 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_price_value_check", nil, self), Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self), Form::Sales::Pages::GrantValueCheck.new(nil, nil, self), - Form::Sales::Pages::PurchasePrice.new("purchase_price_discounted_ownership", nil, self), Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_outright_ownership", nil, self), Form::Sales::Pages::DepositAndMortgageValueCheck.new("discounted_ownership_deposit_and_mortgage_value_check_after_value_and_discount", nil, self), Form::Sales::Pages::Mortgageused.new("mortgage_used_discounted_ownership", nil, self), diff --git a/spec/models/form/sales/pages/purchase_price_spec.rb b/spec/models/form/sales/pages/purchase_price_spec.rb deleted file mode 100644 index 6ec2b7ac0..000000000 --- a/spec/models/form/sales/pages/purchase_price_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Sales::Pages::PurchasePrice, type: :model do - subject(:page) { described_class.new(page_id, page_definition, subsection) } - - let(:page_id) { "purchase_price" } - let(:page_definition) { nil } - let(:subsection) { instance_double(Form::Subsection) } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[value]) - end - - it "has the correct id" do - expect(page.id).to eq("purchase_price") - end - - it "has the correct header" do - expect(page.header).to be_nil - end - - it "has the correct description" do - expect(page.description).to be_nil - end - - it "has correct depends_on" do - expect(page.depends_on).to eq([ - { "ownershipsch" => 2, "rent_to_buy_full_ownership?" => false }, - ]) - end -end diff --git a/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb b/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb index 5919abb24..12cf9b38a 100644 --- a/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb +++ b/spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb @@ -19,7 +19,6 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model extra_borrowing_price_value_check about_price_not_rtb grant_value_check - purchase_price_discounted_ownership purchase_price_outright_ownership discounted_ownership_deposit_and_mortgage_value_check_after_value_and_discount mortgage_used_discounted_ownership diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb index b04980ce4..17ebd4db0 100644 --- a/spec/models/form_handler_spec.rb +++ b/spec/models/form_handler_spec.rb @@ -54,14 +54,14 @@ RSpec.describe FormHandler do it "is able to load a current sales form" do form = form_handler.get_form("current_sales") expect(form).to be_a(Form) - expect(form.pages.count).to eq(181) + expect(form.pages.count).to eq(180) expect(form.name).to eq("2022_2023_sales") end it "is able to load a previous sales form" do form = form_handler.get_form("previous_sales") expect(form).to be_a(Form) - expect(form.pages.count).to eq(181) + expect(form.pages.count).to eq(180) expect(form.name).to eq("2021_2022_sales") end end