Browse Source

Add savings page and update subsection

pull/1052/head
Kat 4 years ago
parent
commit
a6e87c4121
  1. 16
      app/models/form/sales/pages/savings.rb
  2. 1
      app/models/form/sales/subsections/income_benefits_and_savings.rb
  3. 33
      spec/models/form/sales/pages/savings_spec.rb
  4. 1
      spec/models/form/sales/subsections/income_benefits_and_savings_spec.rb

16
app/models/form/sales/pages/savings.rb

@ -0,0 +1,16 @@
class Form::Sales::Pages::Savings < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "savings"
@header = ""
@description = ""
@subsection = subsection
end
def questions
@questions ||= [
Form::Sales::Questions::SavingsNk.new(nil, nil, self),
Form::Sales::Questions::Savings.new(nil, nil, self),
]
end
end

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

@ -12,6 +12,7 @@ class Form::Sales::Subsections::IncomeBenefitsAndSavings < ::Form::Subsection
Form::Sales::Pages::Buyer1Income.new(nil, nil, self), Form::Sales::Pages::Buyer1Income.new(nil, nil, self),
Form::Sales::Pages::Buyer1Mortgage.new(nil, nil, self), Form::Sales::Pages::Buyer1Mortgage.new(nil, nil, self),
Form::Sales::Pages::Buyer2Income.new(nil, nil, self), Form::Sales::Pages::Buyer2Income.new(nil, nil, self),
Form::Sales::Pages::Savings.new(nil, nil, self),
] ]
end end
end end

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

@ -0,0 +1,33 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Savings, 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[savingsnk savings])
end
it "has the correct id" do
expect(page.id).to eq("savings")
end
it "has the correct header" do
expect(page.header).to eq("")
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

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

@ -17,6 +17,7 @@ RSpec.describe Form::Sales::Subsections::IncomeBenefitsAndSavings, type: :model
buyer_1_income buyer_1_income
buyer_1_mortgage buyer_1_mortgage
buyer_2_income buyer_2_income
savings
], ],
) )
end end

Loading…
Cancel
Save