Browse Source

Cldc 1627 update age in check answers and put persons on different check answers cards (#1068)

* Display person 2, 3, 4 age question if their details are known

* Infer check answers value for age questions as 'Not known'

* Hide age known question in check answers if it is answered yes or no

* Add card numbers to household characteristics question

* Update gender identity depends on

* lint

* Add a field to completed sales log in factory

* Update person 1 gender identity to depend on the people count

* Do not show buyer 2 questions if it is not a joint purchase
pull/1083/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
266bf3fda5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/models/form/sales/pages/buyer2_live_in_property.rb
  2. 3
      app/models/form/sales/pages/buyer2_working_situation.rb
  3. 10
      app/models/form/sales/pages/person1_gender_identity.rb
  4. 10
      app/models/form/sales/pages/person1_gender_identity_joint_purchase.rb
  5. 4
      app/models/form/sales/pages/person2_age.rb
  6. 3
      app/models/form/sales/pages/person3_age.rb
  7. 2
      app/models/form/sales/pages/person4_age.rb
  8. 7
      app/models/form/sales/questions/age1.rb
  9. 5
      app/models/form/sales/questions/age2.rb
  10. 13
      app/models/form/sales/questions/buyer1_age_known.rb
  11. 1
      app/models/form/sales/questions/buyer1_ethnic_background_arab.rb
  12. 1
      app/models/form/sales/questions/buyer1_ethnic_background_asian.rb
  13. 1
      app/models/form/sales/questions/buyer1_ethnic_background_black.rb
  14. 1
      app/models/form/sales/questions/buyer1_ethnic_background_mixed.rb
  15. 1
      app/models/form/sales/questions/buyer1_ethnic_background_white.rb
  16. 1
      app/models/form/sales/questions/buyer1_ethnic_group.rb
  17. 1
      app/models/form/sales/questions/buyer1_income.rb
  18. 1
      app/models/form/sales/questions/buyer1_income_known.rb
  19. 1
      app/models/form/sales/questions/buyer1_live_in_property.rb
  20. 1
      app/models/form/sales/questions/buyer1_mortgage.rb
  21. 1
      app/models/form/sales/questions/buyer1_working_situation.rb
  22. 11
      app/models/form/sales/questions/buyer2_age_known.rb
  23. 1
      app/models/form/sales/questions/buyer2_income.rb
  24. 1
      app/models/form/sales/questions/buyer2_income_known.rb
  25. 1
      app/models/form/sales/questions/buyer2_live_in_property.rb
  26. 1
      app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb
  27. 1
      app/models/form/sales/questions/buyer2_working_situation.rb
  28. 1
      app/models/form/sales/questions/gender_identity1.rb
  29. 1
      app/models/form/sales/questions/gender_identity2.rb
  30. 1
      app/models/form/sales/questions/nationality1.rb
  31. 1
      app/models/form/sales/questions/other_nationality1.rb
  32. 5
      app/models/form/sales/questions/person1_age.rb
  33. 4
      app/models/form/sales/questions/person1_age_known.rb
  34. 5
      app/models/form/sales/questions/person2_age.rb
  35. 6
      app/models/form/sales/questions/person2_age_known.rb
  36. 1
      app/models/form/sales/questions/person2_known.rb
  37. 5
      app/models/form/sales/questions/person3_age.rb
  38. 6
      app/models/form/sales/questions/person3_age_known.rb
  39. 1
      app/models/form/sales/questions/person3_known.rb
  40. 5
      app/models/form/sales/questions/person4_age.rb
  41. 6
      app/models/form/sales/questions/person4_age_known.rb
  42. 1
      app/models/form/sales/questions/person4_known.rb
  43. 1
      spec/factories/sales_log.rb
  44. 4
      spec/models/form/sales/pages/buyer2_live_in_property_spec.rb
  45. 4
      spec/models/form/sales/pages/buyer2_working_situation_spec.rb
  46. 8
      spec/models/form/sales/pages/person1_gender_identity_joint_purchase_spec.rb
  47. 10
      spec/models/form/sales/pages/person1_gender_identity_spec.rb
  48. 2
      spec/models/form/sales/pages/person2_age_spec.rb
  49. 2
      spec/models/form/sales/pages/person3_age_spec.rb
  50. 2
      spec/models/form/sales/pages/person4_age_spec.rb
  51. 11
      spec/models/form/sales/questions/age1_spec.rb
  52. 13
      spec/models/form/sales/questions/age2_spec.rb
  53. 17
      spec/models/form/sales/questions/buyer1_age_known_spec.rb
  54. 4
      spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb
  55. 4
      spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb
  56. 4
      spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb
  57. 4
      spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb
  58. 4
      spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb
  59. 4
      spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb
  60. 4
      spec/models/form/sales/questions/buyer1_income_known_spec.rb
  61. 4
      spec/models/form/sales/questions/buyer1_income_spec.rb
  62. 4
      spec/models/form/sales/questions/buyer1_live_in_property_spec.rb
  63. 4
      spec/models/form/sales/questions/buyer1_mortgage_spec.rb
  64. 4
      spec/models/form/sales/questions/buyer1_working_situation_spec.rb
  65. 13
      spec/models/form/sales/questions/buyer2_age_known_spec.rb
  66. 4
      spec/models/form/sales/questions/buyer2_income_known_spec.rb
  67. 4
      spec/models/form/sales/questions/buyer2_income_spec.rb
  68. 4
      spec/models/form/sales/questions/buyer2_live_in_property_spec.rb
  69. 4
      spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb
  70. 4
      spec/models/form/sales/questions/buyer2_working_situation_spec.rb
  71. 4
      spec/models/form/sales/questions/gender_identity1_spec.rb
  72. 4
      spec/models/form/sales/questions/gender_identity2_spec.rb
  73. 4
      spec/models/form/sales/questions/nationality1_spec.rb
  74. 4
      spec/models/form/sales/questions/other_nationality1_spec.rb
  75. 7
      spec/models/form/sales/questions/person1_age_known_spec.rb
  76. 11
      spec/models/form/sales/questions/person1_age_spec.rb
  77. 6
      spec/models/form/sales/questions/person2_age_known_spec.rb
  78. 11
      spec/models/form/sales/questions/person2_age_spec.rb
  79. 4
      spec/models/form/sales/questions/person2_known_spec.rb
  80. 6
      spec/models/form/sales/questions/person3_age_known_spec.rb
  81. 11
      spec/models/form/sales/questions/person3_age_spec.rb
  82. 4
      spec/models/form/sales/questions/person3_known_spec.rb
  83. 6
      spec/models/form/sales/questions/person4_age_known_spec.rb
  84. 11
      spec/models/form/sales/questions/person4_age_spec.rb
  85. 4
      spec/models/form/sales/questions/person4_known_spec.rb

3
app/models/form/sales/pages/buyer2_live_in_property.rb

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

3
app/models/form/sales/pages/buyer2_working_situation.rb

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

10
app/models/form/sales/pages/person1_gender_identity.rb

@ -5,10 +5,12 @@ class Form::Sales::Pages::Person1GenderIdentity < ::Form::Page
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 2,
"details_known_2" => 1,
}]
@depends_on = [
{ "hholdcount" => 1, "jointpur" => 2 },
{ "hholdcount" => 2, "jointpur" => 2 },
{ "hholdcount" => 3, "jointpur" => 2 },
{ "hholdcount" => 4, "jointpur" => 2 },
]
end
def questions

10
app/models/form/sales/pages/person1_gender_identity_joint_purchase.rb

@ -5,10 +5,12 @@ class Form::Sales::Pages::Person1GenderIdentityJointPurchase < ::Form::Page
@header = ""
@description = ""
@subsection = subsection
@depends_on = [{
"jointpur" => 1,
"details_known_3" => 1,
}]
@depends_on = [
{ "hholdcount" => 1, "jointpur" => 1 },
{ "hholdcount" => 2, "jointpur" => 1 },
{ "hholdcount" => 3, "jointpur" => 1 },
{ "hholdcount" => 4, "jointpur" => 1 },
]
end
def questions

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

@ -6,9 +6,7 @@ class Form::Sales::Pages::Person2Age < ::Form::Page
@description = ""
@subsection = subsection
@depends_on = [
{ "hholdcount" => 2, "details_known_2" => 1 },
{ "hholdcount" => 3, "details_known_2" => 1 },
{ "hholdcount" => 4, "details_known_2" => 1 },
{ "details_known_2" => 1 },
]
end

3
app/models/form/sales/pages/person3_age.rb

@ -6,8 +6,7 @@ class Form::Sales::Pages::Person3Age < ::Form::Page
@description = ""
@subsection = subsection
@depends_on = [
{ "hholdcount" => 3, "details_known_3" => 1 },
{ "hholdcount" => 4, "details_known_3" => 1 },
{ "details_known_3" => 1 },
]
end

2
app/models/form/sales/pages/person4_age.rb

@ -6,7 +6,7 @@ class Form::Sales::Pages::Person4Age < ::Form::Page
@description = ""
@subsection = subsection
@depends_on = [
{ "hholdcount" => 4, "details_known_4" => 1 },
{ "details_known_4" => 1 },
]
end

7
app/models/form/sales/questions/age1.rb

@ -7,5 +7,12 @@ class Form::Sales::Questions::Age1 < ::Form::Question
@type = "numeric"
@page = page
@width = 2
@inferred_check_answers_value = {
"condition" => {
"age1_known" => 1,
},
"value" => "Not known",
}
@check_answers_card_number = 1
end
end

5
app/models/form/sales/questions/age2.rb

@ -7,5 +7,10 @@ class Form::Sales::Questions::Age2 < ::Form::Question
@type = "numeric"
@page = page
@width = 2
@inferred_check_answers_value = {
"condition" => { "age2_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 2
end
end

13
app/models/form/sales/questions/buyer1_age_known.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::Buyer1AgeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age1_known"
@check_answer_label = "Buyer 1’s age"
@check_answer_label = "Lead buyer’s age"
@header = "Do you know buyer 1’s age?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@ -11,6 +11,17 @@ class Form::Sales::Questions::Buyer1AgeKnown < ::Form::Question
@conditional_for = {
"age1" => [0],
}
@hidden_in_check_answers = {
"depends_on" => [
{
"age1_known" => 0,
},
{
"age1_known" => 1,
},
],
}
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_ethnic_background_arab.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundArab < ::Form::Question
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_ethnic_background_asian.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundAsian < ::Form::Question
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_ethnic_background_black.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundBlack < ::Form::Question
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_ethnic_background_mixed.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundMixed < ::Form::Question
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_ethnic_background_white.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer1EthnicBackgroundWhite < ::Form::Question
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_ethnic_group.rb

@ -14,6 +14,7 @@ class Form::Sales::Questions::Buyer1EthnicGroup < ::Form::Question
},
"value" => "Prefers not to say",
}
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_income.rb

@ -10,5 +10,6 @@ class Form::Sales::Questions::Buyer1Income < ::Form::Question
@step = 1
@width = 5
@prefix = "£"
@check_answers_card_number = 1
end
end

1
app/models/form/sales/questions/buyer1_income_known.rb

@ -12,6 +12,7 @@ class Form::Sales::Questions::Buyer1IncomeKnown < ::Form::Question
@conditional_for = {
"income1" => [0],
}
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_live_in_property.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer1LiveInProperty < ::Form::Question
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_mortgage.rb

@ -7,6 +7,7 @@ class Form::Sales::Questions::Buyer1Mortgage < ::Form::Question
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer1_working_situation.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer1WorkingSituation < ::Form::Question
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it's a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

11
app/models/form/sales/questions/buyer2_age_known.rb

@ -10,6 +10,17 @@ class Form::Sales::Questions::Buyer2AgeKnown < ::Form::Question
@conditional_for = {
"age2" => [0],
}
@hidden_in_check_answers = {
"depends_on" => [
{
"age2_known" => 0,
},
{
"age2_known" => 1,
},
],
}
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer2_income.rb

@ -10,5 +10,6 @@ class Form::Sales::Questions::Buyer2Income < ::Form::Question
@step = 1
@width = 5
@prefix = "£"
@check_answers_card_number = 2
end
end

1
app/models/form/sales/questions/buyer2_income_known.rb

@ -12,6 +12,7 @@ class Form::Sales::Questions::Buyer2IncomeKnown < ::Form::Question
@conditional_for = {
"income2" => [0],
}
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer2_live_in_property.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer2LiveInProperty < ::Form::Question
@hint_text = ""
@answer_options = ANSWER_OPTIONS
@page = page
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer2_relationship_to_buyer1.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer2RelationshipToBuyer1 < ::Form::Question
@hint_text = ""
@page = page
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/buyer2_working_situation.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::Buyer2WorkingSituation < ::Form::Question
@hint_text = ""
@page = page
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/gender_identity1.rb

@ -8,6 +8,7 @@ class Form::Sales::Questions::GenderIdentity1 < ::Form::Question
@hint_text = "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
@page = page
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/gender_identity2.rb

@ -7,6 +7,7 @@ class Form::Sales::Questions::GenderIdentity2 < ::Form::Question
@type = "radio"
@page = page
@answer_options = ANSWER_OPTIONS
@check_answers_card_number = 2
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/nationality1.rb

@ -18,6 +18,7 @@ class Form::Sales::Questions::Nationality1 < ::Form::Question
},
],
}
@check_answers_card_number = 1
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/other_nationality1.rb

@ -6,5 +6,6 @@ class Form::Sales::Questions::OtherNationality1 < ::Form::Question
@header = "Nationality"
@type = "text"
@page = page
@check_answers_card_number = 1
end
end

5
app/models/form/sales/questions/person1_age.rb

@ -7,5 +7,10 @@ class Form::Sales::Questions::Person1Age < ::Form::Question
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age3_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 3
end
end

4
app/models/form/sales/questions/person1_age_known.rb

@ -16,8 +16,12 @@ class Form::Sales::Questions::Person1AgeKnown < ::Form::Question
{
"age3_known" => 0,
},
{
"age3_known" => 1,
},
],
}
@check_answers_card_number = 3
end
ANSWER_OPTIONS = {

5
app/models/form/sales/questions/person2_age.rb

@ -7,5 +7,10 @@ class Form::Sales::Questions::Person2Age < ::Form::Question
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age4_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 4
end
end

6
app/models/form/sales/questions/person2_age_known.rb

@ -17,13 +17,11 @@ class Form::Sales::Questions::Person2AgeKnown < ::Form::Question
"age4_known" => 0,
},
{
"details_known_2" => nil,
},
{
"details_known_2" => 2,
"age4_known" => 1,
},
],
}
@check_answers_card_number = 4
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/person2_known.rb

@ -15,6 +15,7 @@ class Form::Sales::Questions::Person2Known < ::Form::Question
},
],
}
@check_answers_card_number = 4
end
ANSWER_OPTIONS = {

5
app/models/form/sales/questions/person3_age.rb

@ -7,5 +7,10 @@ class Form::Sales::Questions::Person3Age < ::Form::Question
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age5_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 5
end
end

6
app/models/form/sales/questions/person3_age_known.rb

@ -17,13 +17,11 @@ class Form::Sales::Questions::Person3AgeKnown < ::Form::Question
"age5_known" => 0,
},
{
"details_known_3" => nil,
},
{
"details_known_3" => 2,
"age5_known" => 1,
},
],
}
@check_answers_card_number = 5
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/person3_known.rb

@ -15,6 +15,7 @@ class Form::Sales::Questions::Person3Known < ::Form::Question
},
],
}
@check_answers_card_number = 5
end
ANSWER_OPTIONS = {

5
app/models/form/sales/questions/person4_age.rb

@ -7,5 +7,10 @@ class Form::Sales::Questions::Person4Age < ::Form::Question
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age6_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 6
end
end

6
app/models/form/sales/questions/person4_age_known.rb

@ -17,13 +17,11 @@ class Form::Sales::Questions::Person4AgeKnown < ::Form::Question
"age6_known" => 0,
},
{
"details_known_4" => nil,
},
{
"details_known_4" => 2,
"age6_known" => 1,
},
],
}
@check_answers_card_number = 6
end
ANSWER_OPTIONS = {

1
app/models/form/sales/questions/person4_known.rb

@ -15,6 +15,7 @@ class Form::Sales::Questions::Person4Known < ::Form::Question
},
],
}
@check_answers_card_number = 6
end
ANSWER_OPTIONS = {

1
spec/factories/sales_log.rb

@ -59,6 +59,7 @@ FactoryBot.define do
la { "E09000003" }
savingsnk { 1 }
prevown { 1 }
sex3 { "X" }
end
end
end

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

@ -26,4 +26,8 @@ RSpec.describe Form::Sales::Pages::Buyer2LiveInProperty, type: :model do
it "has the correct description" do
expect(page.description).to eq("")
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "jointpur" => 1 }])
end
end

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

@ -26,4 +26,8 @@ RSpec.describe Form::Sales::Pages::Buyer2WorkingSituation, type: :model do
it "has the correct description" do
expect(page.description).to eq("")
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{ "jointpur" => 1 }])
end
end

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

@ -28,9 +28,9 @@ RSpec.describe Form::Sales::Pages::Person1GenderIdentityJointPurchase, type: :mo
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{
"jointpur" => 1,
"details_known_3" => 1,
}])
expect(page.depends_on).to eq([{ "hholdcount" => 1, "jointpur" => 1 },
{ "hholdcount" => 2, "jointpur" => 1 },
{ "hholdcount" => 3, "jointpur" => 1 },
{ "hholdcount" => 4, "jointpur" => 1 }])
end
end

10
spec/models/form/sales/pages/person1_gender_identity_spec.rb

@ -28,9 +28,11 @@ RSpec.describe Form::Sales::Pages::Person1GenderIdentity, type: :model do
end
it "has correct depends_on" do
expect(page.depends_on).to eq([{
"jointpur" => 2,
"details_known_2" => 1,
}])
expect(page.depends_on).to eq([
{ "hholdcount" => 1, "jointpur" => 2 },
{ "hholdcount" => 2, "jointpur" => 2 },
{ "hholdcount" => 3, "jointpur" => 2 },
{ "hholdcount" => 4, "jointpur" => 2 },
])
end
end

2
spec/models/form/sales/pages/person2_age_spec.rb

@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Pages::Person2Age, type: :model do
it "has correct depends_on" do
expect(page.depends_on).to eq(
[{ "details_known_2" => 1, "hholdcount" => 2 }, { "details_known_2" => 1, "hholdcount" => 3 }, { "details_known_2" => 1, "hholdcount" => 4 }],
[{ "details_known_2" => 1 }],
)
end
end

2
spec/models/form/sales/pages/person3_age_spec.rb

@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Pages::Person3Age, type: :model do
it "has correct depends_on" do
expect(page.depends_on).to eq(
[{ "details_known_3" => 1, "hholdcount" => 3 }, { "details_known_3" => 1, "hholdcount" => 4 }],
[{ "details_known_3" => 1 }],
)
end
end

2
spec/models/form/sales/pages/person4_age_spec.rb

@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Pages::Person4Age, type: :model do
it "has correct depends_on" do
expect(page.depends_on).to eq(
[{ "details_known_4" => 1, "hholdcount" => 4 }],
[{ "details_known_4" => 1 }],
)
end
end

11
spec/models/form/sales/questions/age1_spec.rb

@ -38,4 +38,15 @@ RSpec.describe Form::Sales::Questions::Age1, type: :model do
it "has the correct width" do
expect(question.width).to eq(2)
end
it "has the correct inferred check answers value" do
expect(question.inferred_check_answers_value).to eq({
"condition" => { "age1_known" => 1 },
"value" => "Not known",
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

13
spec/models/form/sales/questions/age2_spec.rb

@ -38,4 +38,17 @@ RSpec.describe Form::Sales::Questions::Age2, type: :model do
it "has the correct width" do
expect(question.width).to eq(2)
end
it "has the correct inferred check answers value" do
expect(question.inferred_check_answers_value).to eq({
"condition" => {
"age2_known" => 1,
},
"value" => "Not known",
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

17
spec/models/form/sales/questions/buyer1_age_known_spec.rb

@ -20,7 +20,7 @@ RSpec.describe Form::Sales::Questions::Buyer1AgeKnown, type: :model do
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Buyer 1’s age")
expect(question.check_answer_label).to eq("Lead buyer’s age")
end
it "has the correct type" do
@ -48,4 +48,19 @@ RSpec.describe Form::Sales::Questions::Buyer1AgeKnown, type: :model do
it "has the correct hint" do
expect(question.hint_text).to eq("Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest.")
end
it "has correct hidden_in_check_answers for" do
expect(question.hidden_in_check_answers).to eq({
"depends_on" => [{
"age1_known" => 0,
},
{
"age1_known" => 1,
}],
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb

@ -41,4 +41,8 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundArab, type: :model
"19" => { "value" => "Arab" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb

@ -44,4 +44,8 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundAsian, type: :model
"9" => { "value" => "Pakistani" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb

@ -42,4 +42,8 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundBlack, type: :model
"14" => { "value" => "Any other Black, African or Caribbean background" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb

@ -43,4 +43,8 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundMixed, type: :model
"7" => { "value" => "Any other Mixed or Multiple ethnic background" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb

@ -43,4 +43,8 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundWhite, type: :model
"3" => { "value" => "Any other White background" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb

@ -46,4 +46,8 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicGroup, type: :model do
"divider" => { "value" => true },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_income_known_spec.rb

@ -52,4 +52,8 @@ RSpec.describe Form::Sales::Questions::Buyer1IncomeKnown, type: :model do
expect(question.bottom_guidance?).to eq(true)
expect(question.top_guidance?).to eq(false)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_income_spec.rb

@ -50,4 +50,8 @@ RSpec.describe Form::Sales::Questions::Buyer1Income, type: :model do
it "has correct min" do
expect(question.min).to eq(0)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_live_in_property_spec.rb

@ -45,4 +45,8 @@ RSpec.describe Form::Sales::Questions::Buyer1LiveInProperty, type: :model do
it "has the correct hint" do
expect(question.hint_text).to eq("Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest.")
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_mortgage_spec.rb

@ -37,4 +37,8 @@ RSpec.describe Form::Sales::Questions::Buyer1Mortgage, type: :model do
"2" => { "value" => "No" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/buyer1_working_situation_spec.rb

@ -45,4 +45,8 @@ RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do
"7" => { "value" => "Full-time student" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

13
spec/models/form/sales/questions/buyer2_age_known_spec.rb

@ -43,4 +43,17 @@ RSpec.describe Form::Sales::Questions::Buyer2AgeKnown, type: :model do
"age2" => [0],
})
end
it "has correct hidden in check answers" do
expect(question.hidden_in_check_answers).to eq({
"depends_on" => [{
"age2_known" => 0,
},
{ "age2_known" => 1 }],
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

4
spec/models/form/sales/questions/buyer2_income_known_spec.rb

@ -52,4 +52,8 @@ RSpec.describe Form::Sales::Questions::Buyer2IncomeKnown, type: :model do
expect(question.bottom_guidance?).to eq(true)
expect(question.top_guidance?).to eq(false)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

4
spec/models/form/sales/questions/buyer2_income_spec.rb

@ -50,4 +50,8 @@ RSpec.describe Form::Sales::Questions::Buyer2Income, type: :model do
it "has correct min" do
expect(question.min).to eq(0)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

4
spec/models/form/sales/questions/buyer2_live_in_property_spec.rb

@ -41,4 +41,8 @@ RSpec.describe Form::Sales::Questions::Buyer2LiveInProperty, type: :model do
"2" => { "value" => "No" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

4
spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb

@ -43,4 +43,8 @@ RSpec.describe Form::Sales::Questions::Buyer2RelationshipToBuyer1, type: :model
"R" => { "value" => "Buyer prefers not to say" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

4
spec/models/form/sales/questions/buyer2_working_situation_spec.rb

@ -50,4 +50,8 @@ RSpec.describe Form::Sales::Questions::Buyer2WorkingSituation, type: :model do
"9" => { "value" => "Child under 16" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

4
spec/models/form/sales/questions/gender_identity1_spec.rb

@ -43,4 +43,8 @@ RSpec.describe Form::Sales::Questions::GenderIdentity1, type: :model do
"R" => { "value" => "Prefers not to say " },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/gender_identity2_spec.rb

@ -39,4 +39,8 @@ RSpec.describe Form::Sales::Questions::GenderIdentity2, type: :model do
"R" => { "value" => "Buyer prefers not to say" },
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(2)
end
end

4
spec/models/form/sales/questions/nationality1_spec.rb

@ -60,4 +60,8 @@ RSpec.describe Form::Sales::Questions::Nationality1, type: :model do
],
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

4
spec/models/form/sales/questions/other_nationality1_spec.rb

@ -34,4 +34,8 @@ RSpec.describe Form::Sales::Questions::OtherNationality1, type: :model do
it "has the correct hint" do
expect(question.hint_text).to be_nil
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(1)
end
end

7
spec/models/form/sales/questions/person1_age_known_spec.rb

@ -55,8 +55,15 @@ RSpec.describe Form::Sales::Questions::Person1AgeKnown, type: :model do
{
"age3_known" => 0,
},
{
"age3_known" => 1,
},
],
},
)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(3)
end
end

11
spec/models/form/sales/questions/person1_age_spec.rb

@ -38,4 +38,15 @@ RSpec.describe Form::Sales::Questions::Person1Age, type: :model do
it "has the correct width" do
expect(question.width).to eq(3)
end
it "has the correct inferred check answers value" do
expect(question.inferred_check_answers_value).to eq({
"condition" => { "age3_known" => 1 },
"value" => "Not known",
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(3)
end
end

6
spec/models/form/sales/questions/person2_age_known_spec.rb

@ -51,8 +51,12 @@ RSpec.describe Form::Sales::Questions::Person2AgeKnown, type: :model do
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"depends_on" => [{ "age4_known" => 0 }, { "details_known_2" => nil }, { "details_known_2" => 2 }],
"depends_on" => [{ "age4_known" => 0 }, { "age4_known" => 1 }],
},
)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(4)
end
end

11
spec/models/form/sales/questions/person2_age_spec.rb

@ -38,4 +38,15 @@ RSpec.describe Form::Sales::Questions::Person2Age, type: :model do
it "has the correct width" do
expect(question.width).to eq(3)
end
it "has the correct inferred check answers value" do
expect(question.inferred_check_answers_value).to eq({
"condition" => { "age4_known" => 1 },
"value" => "Not known",
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(4)
end
end

4
spec/models/form/sales/questions/person2_known_spec.rb

@ -57,4 +57,8 @@ RSpec.describe Form::Sales::Questions::Person2Known, type: :model do
},
)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(4)
end
end

6
spec/models/form/sales/questions/person3_age_known_spec.rb

@ -51,8 +51,12 @@ RSpec.describe Form::Sales::Questions::Person3AgeKnown, type: :model do
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"depends_on" => [{ "age5_known" => 0 }, { "details_known_3" => nil }, { "details_known_3" => 2 }],
"depends_on" => [{ "age5_known" => 0 }, { "age5_known" => 1 }],
},
)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(5)
end
end

11
spec/models/form/sales/questions/person3_age_spec.rb

@ -38,4 +38,15 @@ RSpec.describe Form::Sales::Questions::Person3Age, type: :model do
it "has the correct width" do
expect(question.width).to eq(3)
end
it "has the correct inferred check answers value" do
expect(question.inferred_check_answers_value).to eq({
"condition" => { "age5_known" => 1 },
"value" => "Not known",
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(5)
end
end

4
spec/models/form/sales/questions/person3_known_spec.rb

@ -57,4 +57,8 @@ RSpec.describe Form::Sales::Questions::Person3Known, type: :model do
},
)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(5)
end
end

6
spec/models/form/sales/questions/person4_age_known_spec.rb

@ -51,8 +51,12 @@ RSpec.describe Form::Sales::Questions::Person4AgeKnown, type: :model do
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"depends_on" => [{ "age6_known" => 0 }, { "details_known_4" => nil }, { "details_known_4" => 2 }],
"depends_on" => [{ "age6_known" => 0 }, { "age6_known" => 1 }],
},
)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(6)
end
end

11
spec/models/form/sales/questions/person4_age_spec.rb

@ -38,4 +38,15 @@ RSpec.describe Form::Sales::Questions::Person4Age, type: :model do
it "has the correct width" do
expect(question.width).to eq(3)
end
it "has the correct inferred check answers value" do
expect(question.inferred_check_answers_value).to eq({
"condition" => { "age6_known" => 1 },
"value" => "Not known",
})
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(6)
end
end

4
spec/models/form/sales/questions/person4_known_spec.rb

@ -57,4 +57,8 @@ RSpec.describe Form::Sales::Questions::Person4Known, type: :model do
},
)
end
it "has the correct check_answers_card_number" do
expect(question.check_answers_card_number).to eq(6)
end
end

Loading…
Cancel
Save