Browse Source

feat: update to main

pull/1134/head
natdeanlewissoftwire 3 years ago
parent
commit
138fa18c98
  1. 15
      app/models/form/sales/pages/about_deposit.rb
  2. 18
      app/models/form/sales/pages/about_price.rb
  3. 19
      app/models/form/sales/pages/about_price_social_housing.rb
  4. 1
      app/models/sales_log.rb
  5. 33
      spec/models/form/sales/pages/about_deposit_spec.rb
  6. 35
      spec/models/form/sales/pages/about_price_social_housing_spec.rb
  7. 35
      spec/models/form/sales/pages/about_price_spec.rb
  8. 14
      spec/models/form/sales/subsections/outright_sale_spec.rb

15
app/models/form/sales/pages/about_deposit.rb

@ -1,15 +0,0 @@
class Form::Sales::Pages::AboutDeposit < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = "About the deposit"
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::DepositAmount.new(nil, nil, self),
Form::Sales::Questions::DepositDiscount.new(nil, nil, self),
]
end
end

18
app/models/form/sales/pages/about_price.rb

@ -1,18 +0,0 @@
class Form::Sales::Pages::AboutPrice < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "about_price"
@header = "About the price of the property"
@description = ""
@subsection = subsection
@depends_on = [{
"soctenant" => 2,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Value.new(nil, nil, self),
]
end
end

19
app/models/form/sales/pages/about_price_social_housing.rb

@ -1,19 +0,0 @@
class Form::Sales::Pages::AboutPriceSocialHousing < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "about_price_social_housing"
@header = "About the price of the property"
@description = ""
@subsection = subsection
@depends_on = [{
"soctenant" => 1,
}]
end
def questions
@questions ||= [
Form::Sales::Questions::Value.new(nil, nil, self),
Form::Sales::Questions::Equity.new(nil, nil, self),
]
end
end

1
app/models/sales_log.rb

@ -2,6 +2,7 @@ class SalesLogValidator < ActiveModel::Validator
include Validations::Sales::HouseholdValidations
include Validations::SharedValidations
include Validations::Sales::FinancialValidations
include Validations::LocalAuthorityValidations
def validate(record)
validation_methods = public_methods.select { |method| method.starts_with?("validate_") }

33
spec/models/form/sales/pages/about_deposit_spec.rb

@ -1,33 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::AboutDeposit, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
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[deposit cashdis])
end
it "has the correct id" do
expect(page.id).to eq(nil)
end
it "has the correct header" do
expect(page.header).to eq("About the deposit")
end
it "has the correct description" do
expect(page.description).to eq("")
end
it "has correct depends_on" do
expect(page.depends_on).to be_nil
end
end

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

@ -1,35 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::AboutPriceSocialHousing, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
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 equity])
end
it "has the correct id" do
expect(page.id).to eq("about_price_social_housing")
end
it "has the correct header" do
expect(page.header).to eq("About the price of the property")
end
it "has the correct description" do
expect(page.description).to eq("")
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{
"soctenant" => 1,
}])
end
end

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

@ -1,35 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::AboutPrice, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
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("about_price")
end
it "has the correct header" do
expect(page.header).to eq("About the price of the property")
end
it "has the correct description" do
expect(page.description).to eq("")
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{
"soctenant" => 2,
}])
end
end

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

@ -13,12 +13,14 @@ RSpec.describe Form::Sales::Subsections::OutrightSale, type: :model do
it "has correct pages" do
expect(outright_sale.pages.map(&:id)).to eq(
%w[purchase_price
mortgage_used_outright_sale
mortgage_amount_outright_sale
about_deposit_outright_sale
outright_sale_deposit_value_check
leasehold_charges_outright_sale],
%w[
purchase_price
mortgage_used_outright_sale
mortgage_amount_outright_sale
about_deposit_outright_sale
outright_sale_deposit_value_check
leasehold_charges_outright_sale
],
)
end

Loading…
Cancel
Save