Browse Source

Update sales soft validations

pull/1584/head
Kat 3 years ago
parent
commit
3338dfbed3
  1. 4
      app/models/form/sales/pages/about_price_value_check.rb
  2. 4
      app/models/form/sales/pages/buyer1_income_value_check.rb
  3. 4
      app/models/form/sales/pages/buyer2_income_value_check.rb
  4. 4
      app/models/form/sales/pages/buyer_live_in_value_check.rb
  5. 4
      app/models/form/sales/pages/deposit_and_mortgage_value_check.rb
  6. 4
      app/models/form/sales/pages/deposit_value_check.rb
  7. 4
      app/models/form/sales/pages/discounted_sale_value_check.rb
  8. 4
      app/models/form/sales/pages/extra_borrowing_value_check.rb
  9. 4
      app/models/form/sales/pages/grant_value_check.rb
  10. 4
      app/models/form/sales/pages/handover_date_check.rb
  11. 4
      app/models/form/sales/pages/household_wheelchair_check.rb
  12. 4
      app/models/form/sales/pages/monthly_charges_value_check.rb
  13. 4
      app/models/form/sales/pages/mortgage_value_check.rb
  14. 4
      app/models/form/sales/pages/old_persons_shared_ownership_value_check.rb
  15. 4
      app/models/form/sales/pages/percentage_discount_value_check.rb
  16. 4
      app/models/form/sales/pages/person_student_not_child_value_check.rb
  17. 4
      app/models/form/sales/pages/retirement_value_check.rb
  18. 4
      app/models/form/sales/pages/savings_value_check.rb
  19. 4
      app/models/form/sales/pages/shared_ownership_deposit_value_check.rb
  20. 4
      app/models/form/sales/pages/staircase_bought_value_check.rb
  21. 4
      spec/models/form/sales/pages/about_price_value_check_spec.rb
  22. 4
      spec/models/form/sales/pages/buyer1_income_value_check_spec.rb
  23. 8
      spec/models/form/sales/pages/buyer_live_in_value_check_spec.rb
  24. 4
      spec/models/form/sales/pages/deposit_value_check_spec.rb
  25. 4
      spec/models/form/sales/pages/discounted_sale_value_check_spec.rb
  26. 4
      spec/models/form/sales/pages/handover_date_check_spec.rb
  27. 4
      spec/models/form/sales/pages/household_wheelchair_check_spec.rb
  28. 4
      spec/models/form/sales/pages/monthly_charges_value_check_spec.rb
  29. 4
      spec/models/form/sales/pages/mortgage_value_check_spec.rb
  30. 4
      spec/models/form/sales/pages/old_persons_shared_ownership_value_check_spec.rb
  31. 4
      spec/models/form/sales/pages/percentage_discount_value_check_spec.rb
  32. 24
      spec/models/form/sales/pages/person_student_not_child_value_check_spec.rb
  33. 24
      spec/models/form/sales/pages/retirement_value_check_spec.rb
  34. 4
      spec/models/form/sales/pages/savings_value_check_spec.rb
  35. 4
      spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb

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

@ -37,4 +37,8 @@ class Form::Sales::Pages::AboutPriceValueCheck < ::Form::Page
Form::Sales::Questions::AboutPriceValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[value beds la]
end
end

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

@ -29,4 +29,8 @@ class Form::Sales::Pages::Buyer1IncomeValueCheck < ::Form::Page
Form::Sales::Questions::Buyer1IncomeValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[ecstat1 income1]
end
end

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

@ -32,4 +32,8 @@ class Form::Sales::Pages::Buyer2IncomeValueCheck < ::Form::Page
Form::Sales::Questions::Buyer2IncomeValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[ecstat2 income2]
end
end

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

@ -18,4 +18,8 @@ class Form::Sales::Pages::BuyerLiveInValueCheck < Form::Sales::Pages::Person
Form::Sales::Questions::BuyerLiveInValueCheck.new(nil, nil, self, person_index: @person_index),
]
end
def affected_question_ids
["ownershipsch", "buy#{@person_index}livein"]
end
end

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

@ -14,4 +14,8 @@ class Form::Sales::Pages::DepositAndMortgageValueCheck < ::Form::Page
Form::Sales::Questions::DepositAndMortgageValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[mortgage deposit value discount]
end
end

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

@ -14,4 +14,8 @@ class Form::Sales::Pages::DepositValueCheck < ::Form::Page
Form::Sales::Questions::DepositValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[savings deposit]
end
end

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

@ -35,4 +35,8 @@ class Form::Sales::Pages::DiscountedSaleValueCheck < ::Form::Page
Form::Sales::Questions::DiscountedSaleValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[value deposit ownershipsch mortgage mortgageused discount grant type]
end
end

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

@ -17,4 +17,8 @@ class Form::Sales::Pages::ExtraBorrowingValueCheck < Form::Page
Form::Sales::Questions::ExtraBorrowingValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[extrabor mortgage deposit value discount]
end
end

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

@ -15,4 +15,8 @@ class Form::Sales::Pages::GrantValueCheck < ::Form::Page
Form::Sales::Questions::GrantValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[grant]
end
end

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

@ -16,4 +16,8 @@ class Form::Sales::Pages::HandoverDateCheck < ::Form::Page
Form::Sales::Questions::HandoverDateCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[hodate saledate]
end
end

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

@ -14,4 +14,8 @@ class Form::Sales::Pages::HouseholdWheelchairCheck < ::Form::Page
Form::Sales::Questions::HouseholdWheelchairCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[disabled wheel]
end
end

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

@ -18,4 +18,8 @@ class Form::Sales::Pages::MonthlyChargesValueCheck < ::Form::Page
Form::Sales::Questions::MonthlyChargesValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[type mscharge proptype]
end
end

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

@ -28,4 +28,8 @@ class Form::Sales::Pages::MortgageValueCheck < ::Form::Page
]
end
end
def affected_question_ids
%w[mortgage inc1mort inc2mort jointpur income1 income2 inc1mort inc2mort]
end
end

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

@ -18,4 +18,8 @@ class Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck < ::Form::Page
Form::Sales::Questions::OldPersonsSharedOwnershipValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[type jointpur age1 age2]
end
end

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

@ -12,4 +12,8 @@ class Form::Sales::Pages::PercentageDiscountValueCheck < ::Form::Page
def questions
@questions ||= [Form::Sales::Questions::PercentageDiscountValueCheck.new(nil, nil, self)]
end
def affected_question_ids
%w[discount proptype]
end
end

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

@ -18,4 +18,8 @@ class Form::Sales::Pages::PersonStudentNotChildValueCheck < Form::Sales::Pages::
Form::Sales::Questions::PersonStudentNotChildValueCheck.new(nil, nil, self, person_index: @person_index),
]
end
def affected_question_ids
["relat#{@person_index}", "exstat#{@person_index}", "age#{@person_index}"]
end
end

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

@ -39,4 +39,8 @@ class Form::Sales::Pages::RetirementValueCheck < Form::Sales::Pages::Person
Form::Sales::Questions::RetirementValueCheck.new(nil, nil, self, person_index: @person_index),
]
end
def affected_question_ids
["age#{@person_index}", "exstat#{@person_index}", "sex#{@person_index}"]
end
end

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

@ -14,4 +14,8 @@ class Form::Sales::Pages::SavingsValueCheck < ::Form::Page
Form::Sales::Questions::SavingsValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[savings]
end
end

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

@ -24,4 +24,8 @@ class Form::Sales::Pages::SharedOwnershipDepositValueCheck < ::Form::Page
Form::Sales::Questions::SharedOwnershipDepositValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[mortgage mortgageused cashdis type deposit value equity]
end
end

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

@ -24,4 +24,8 @@ class Form::Sales::Pages::StaircaseBoughtValueCheck < ::Form::Page
Form::Sales::Questions::StaircaseBoughtValueCheck.new(nil, nil, self),
]
end
def affected_question_ids
%w[stairbought]
end
end

4
spec/models/form/sales/pages/about_price_value_check_spec.rb

@ -51,4 +51,8 @@ RSpec.describe Form::Sales::Pages::AboutPriceValueCheck, type: :model do
],
})
end
it "has the correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[value beds la])
end
end

4
spec/models/form/sales/pages/buyer1_income_value_check_spec.rb

@ -34,4 +34,8 @@ RSpec.describe Form::Sales::Pages::Buyer1IncomeValueCheck, type: :model do
it "is interruption screen page" do
expect(page.interruption_screen?).to eq(true)
end
it "is has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[ecstat1 income1])
end
end

8
spec/models/form/sales/pages/buyer_live_in_value_check_spec.rb

@ -43,6 +43,10 @@ RSpec.describe Form::Sales::Pages::BuyerLiveInValueCheck, type: :model do
})
end
it "has the correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[ownershipsch buy1livein])
end
context "with buyer 2" do
let(:person_index) { 2 }
@ -60,5 +64,9 @@ RSpec.describe Form::Sales::Pages::BuyerLiveInValueCheck, type: :model do
"arguments" => [{ "key" => "ownership_scheme", "label" => false, "i18n_template" => "ownership_scheme" }],
})
end
it "has the correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[ownershipsch buy2livein])
end
end
end

4
spec/models/form/sales/pages/deposit_value_check_spec.rb

@ -34,4 +34,8 @@ RSpec.describe Form::Sales::Pages::DepositValueCheck, type: :model do
it "is interruption screen page" do
expect(page.interruption_screen?).to eq(true)
end
it "is has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[savings deposit])
end
end

4
spec/models/form/sales/pages/discounted_sale_value_check_spec.rb

@ -49,4 +49,8 @@ RSpec.describe Form::Sales::Pages::DiscountedSaleValueCheck, type: :model do
},
])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[value deposit ownershipsch mortgage mortgageused discount grant type])
end
end

4
spec/models/form/sales/pages/handover_date_check_spec.rb

@ -44,4 +44,8 @@ RSpec.describe Form::Sales::Pages::HandoverDateCheck, type: :model do
it "is interruption screen page" do
expect(page.interruption_screen?).to eq(true)
end
it "is has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[hodate saledate])
end
end

4
spec/models/form/sales/pages/household_wheelchair_check_spec.rb

@ -34,4 +34,8 @@ RSpec.describe Form::Sales::Pages::HouseholdWheelchairCheck, type: :model do
it "is interruption screen page" do
expect(page.interruption_screen?).to eq(true)
end
it "is has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[disabled wheel])
end
end

4
spec/models/form/sales/pages/monthly_charges_value_check_spec.rb

@ -45,4 +45,8 @@ RSpec.describe Form::Sales::Pages::MonthlyChargesValueCheck, type: :model do
it "has correct informative_text" do
expect(page.informative_text).to eq({})
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[type mscharge proptype])
end
end

4
spec/models/form/sales/pages/mortgage_value_check_spec.rb

@ -36,6 +36,10 @@ RSpec.describe Form::Sales::Pages::MortgageValueCheck, type: :model do
])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[mortgage inc1mort inc2mort jointpur income1 income2 inc1mort inc2mort])
end
context "when checking buyer 2" do
let(:index) { 2 }

4
spec/models/form/sales/pages/old_persons_shared_ownership_value_check_spec.rb

@ -41,4 +41,8 @@ RSpec.describe Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck, type: :m
it "has the correct informative_text" do
expect(page.informative_text).to eq({})
end
it "has the correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[type jointpur age1 age2])
end
end

4
spec/models/form/sales/pages/percentage_discount_value_check_spec.rb

@ -45,4 +45,8 @@ RSpec.describe Form::Sales::Pages::PercentageDiscountValueCheck, type: :model do
},
])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[discount proptype])
end
end

24
spec/models/form/sales/pages/person_student_not_child_value_check_spec.rb

@ -39,6 +39,10 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
expect(page.questions.map(&:id)).to eq(%w[student_not_child_value_check])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[relat2 exstat2 age2])
end
context "with person 2" do
let(:person_index) { 2 }
let(:page_id) { "person_2_student_not_child_value_check" }
@ -50,6 +54,10 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "person_2_student_not_child?" => true }])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[relat2 exstat2 age2])
end
end
context "with person 3" do
@ -63,6 +71,10 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "person_3_student_not_child?" => true }])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[relat3 exstat3 age3])
end
end
context "with person 4" do
@ -76,6 +88,10 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "person_4_student_not_child?" => true }])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[relat4 exstat4 age4])
end
end
context "with person 5" do
@ -89,6 +105,10 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "person_5_student_not_child?" => true }])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[relat5 exstat5 age5])
end
end
context "with person 6" do
@ -102,5 +122,9 @@ RSpec.describe Form::Sales::Pages::PersonStudentNotChildValueCheck, type: :model
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "person_6_student_not_child?" => true }])
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[relat6 exstat6 age6])
end
end
end

24
spec/models/form/sales/pages/retirement_value_check_spec.rb

@ -71,6 +71,10 @@ RSpec.describe Form::Sales::Pages::RetirementValueCheck, type: :model do
],
})
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[age1 exstat1 sex1])
end
end
context "with person 2" do
@ -119,6 +123,10 @@ RSpec.describe Form::Sales::Pages::RetirementValueCheck, type: :model do
],
})
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[age2 exstat2 sex2])
end
end
context "with person 3" do
@ -167,6 +175,10 @@ RSpec.describe Form::Sales::Pages::RetirementValueCheck, type: :model do
],
})
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[age3 exstat3 sex3])
end
end
context "with person 4" do
@ -215,6 +227,10 @@ RSpec.describe Form::Sales::Pages::RetirementValueCheck, type: :model do
],
})
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[age4 exstat4 sex4])
end
end
context "with person 5" do
@ -263,6 +279,10 @@ RSpec.describe Form::Sales::Pages::RetirementValueCheck, type: :model do
],
})
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[age5 exstat5 sex5])
end
end
context "with person 6" do
@ -311,5 +331,9 @@ RSpec.describe Form::Sales::Pages::RetirementValueCheck, type: :model do
],
})
end
it "has correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[age6 exstat6 sex6])
end
end
end

4
spec/models/form/sales/pages/savings_value_check_spec.rb

@ -34,4 +34,8 @@ RSpec.describe Form::Sales::Pages::SavingsValueCheck, type: :model do
it "is interruption screen page" do
expect(page.interruption_screen?).to eq(true)
end
it "has the correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[savings])
end
end

4
spec/models/form/sales/pages/shared_ownership_deposit_value_check_spec.rb

@ -41,4 +41,8 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :mode
it "has the correct informative_text" do
expect(page.informative_text).to eq({})
end
it "has the correct affected_question_ids" do
expect(page.affected_question_ids).to eq(%w[mortgage mortgageused cashdis type deposit value equity])
end
end

Loading…
Cancel
Save