Browse Source

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
pull/1285/head^2
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
2e279d251d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      app/models/form/sales/pages/purchase_price.rb
  2. 1
      app/models/form/sales/subsections/discounted_ownership_scheme.rb
  3. 35
      spec/models/form/sales/pages/purchase_price_spec.rb
  4. 1
      spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb
  5. 4
      spec/models/form_handler_spec.rb

14
app/models/form/sales/pages/purchase_price.rb

@ -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

1
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),

35
spec/models/form/sales/pages/purchase_price_spec.rb

@ -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

1
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

4
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

Loading…
Cancel
Save