Browse Source

Add the value check to the new sections

pull/1102/head
Kat 3 years ago
parent
commit
8a72e37b60
  1. 1
      app/models/form/sales/subsections/discounted_ownership_scheme.rb
  2. 1
      app/models/form/sales/subsections/outright_sale.rb
  3. 1
      app/models/form/sales/subsections/shared_ownership_scheme.rb
  4. 2
      app/models/validations/sales/soft_validations.rb
  5. 1
      spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb
  6. 3
      spec/models/form/sales/subsections/outright_sale_spec.rb
  7. 1
      spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb
  8. 4
      spec/models/form_handler_spec.rb

1
app/models/form/sales/subsections/discounted_ownership_scheme.rb

@ -14,6 +14,7 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self), Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_discounted_ownership", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_discounted_ownership", nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self),
Form::Sales::Pages::DepositValueCheck.new("discounted_ownership_deposit_value_check", nil, self),
] ]
end end

1
app/models/form/sales/subsections/outright_sale.rb

@ -12,6 +12,7 @@ class Form::Sales::Subsections::OutrightSale < ::Form::Subsection
Form::Sales::Pages::PurchasePrice.new(nil, nil, self), Form::Sales::Pages::PurchasePrice.new(nil, nil, self),
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self),
Form::Sales::Pages::DepositValueCheck.new("outright_sale_deposit_value_check", nil, self),
] ]
end end

1
app/models/form/sales/subsections/shared_ownership_scheme.rb

@ -21,6 +21,7 @@ class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_shared_ownership", nil, self), Form::Sales::Pages::MortgageAmount.new("mortgage_amount_shared_ownership", nil, self),
Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self), Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self),
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self), Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self),
Form::Sales::Pages::DepositValueCheck.new("shared_ownership_deposit_value_check", nil, self),
Form::Sales::Pages::MonthlyRent.new(nil, nil, self), Form::Sales::Pages::MonthlyRent.new(nil, nil, self),
] ]
end end

2
app/models/validations/sales/soft_validations.rb

@ -26,7 +26,7 @@ module Validations::Sales::SoftValidations
wheel == 1 wheel == 1
end end
def savings_over_soft_max? def savings_over_soft_max?
savings && savings > 100_000 savings && savings > 100_000
end end

1
spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb

@ -19,6 +19,7 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model
about_price_not_rtb about_price_not_rtb
mortgage_amount_discounted_ownership mortgage_amount_discounted_ownership
about_deposit_discounted_ownership about_deposit_discounted_ownership
discounted_ownership_deposit_value_check
], ],
) )
end end

3
spec/models/form/sales/subsections/outright_sale_spec.rb

@ -15,7 +15,8 @@ RSpec.describe Form::Sales::Subsections::OutrightSale, type: :model do
expect(outright_sale.pages.map(&:id)).to eq( expect(outright_sale.pages.map(&:id)).to eq(
%w[purchase_price %w[purchase_price
mortgage_amount_outright_sale mortgage_amount_outright_sale
about_deposit_outright_sale], about_deposit_outright_sale
outright_sale_deposit_value_check],
) )
end end

1
spec/models/form/sales/subsections/shared_ownership_scheme_spec.rb

@ -26,6 +26,7 @@ RSpec.describe Form::Sales::Subsections::SharedOwnershipScheme, type: :model do
mortgage_amount_shared_ownership mortgage_amount_shared_ownership
about_deposit_with_discount about_deposit_with_discount
about_deposit_shared_ownership about_deposit_shared_ownership
shared_ownership_deposit_value_check
monthly_rent monthly_rent
], ],
) )

4
spec/models/form_handler_spec.rb

@ -52,14 +52,14 @@ RSpec.describe FormHandler do
it "is able to load a current sales form" do it "is able to load a current sales form" do
form = form_handler.get_form("current_sales") form = form_handler.get_form("current_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(109) expect(form.pages.count).to eq(112)
expect(form.name).to eq("2022_2023_sales") expect(form.name).to eq("2022_2023_sales")
end end
it "is able to load a previous sales form" do it "is able to load a previous sales form" do
form = form_handler.get_form("previous_sales") form = form_handler.get_form("previous_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(109) expect(form.pages.count).to eq(112)
expect(form.name).to eq("2021_2022_sales") expect(form.name).to eq("2021_2022_sales")
end end
end end

Loading…
Cancel
Save