Browse Source

feat: add depends_on and tests

pull/919/head
natdeanlewissoftwire 3 years ago
parent
commit
a031315ecc
  1. 4
      app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb
  2. 1
      spec/factories/sales_log.rb
  3. 2
      spec/models/form/sales/subsections/household_characteristics_spec.rb
  4. 4
      spec/models/form_handler_spec.rb

4
app/models/form/sales/pages/buyer2_relationship_to_buyer1.rb

@ -5,6 +5,10 @@ class Form::Sales::Pages::Buyer2RelationshipToBuyer1 < ::Form::Page
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
}]
end
def questions

1
spec/factories/sales_log.rb

@ -23,6 +23,7 @@ FactoryBot.define do
age1 { 30 }
sex1 { "X" }
buy1livein { 1 }
relat2 { "P" }
proptype { 1 }
age2_known { 0 }
age2 { 35 }

2
spec/models/form/sales/subsections/household_characteristics_spec.rb

@ -13,7 +13,7 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model
it "has correct pages" do
expect(household_characteristics.pages.map(&:id)).to eq(
%w[buyer_1_age buyer_1_gender_identity buyer_1_live_in_property buyer_2_age],
%w[buyer_1_age buyer_1_gender_identity buyer_1_live_in_property buyer_2_relationship_to_buyer_1 buyer_2_age],
)
end

4
spec/models/form_handler_spec.rb

@ -61,14 +61,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(17)
expect(form.pages.count).to eq(18)
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(17)
expect(form.pages.count).to eq(18)
expect(form.name).to eq("2021_2022_sales")
end
end

Loading…
Cancel
Save