Browse Source

feat: remove duplicated purchase price page and delete as it's not used elsewhere

pull/1324/head
natdeanlewissoftwire 3 years ago
parent
commit
9737e90bbf
  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

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
Loading…
Cancel
Save