Browse Source

Refactor age to reuse pages and questions (#1092)

* Refactor age to reuse pages and questions

* lint
pull/1095/head
kosiakkatrina 2 years ago committed by GitHub
parent
commit
2f7fd7640c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/components/check_answers_summary_list_card_component.html.erb
  2. 19
      app/models/form/sales/pages/person1_age.rb
  3. 19
      app/models/form/sales/pages/person2_age.rb
  4. 19
      app/models/form/sales/pages/person3_age.rb
  5. 19
      app/models/form/sales/pages/person4_age.rb
  6. 29
      app/models/form/sales/pages/person_age.rb
  7. 16
      app/models/form/sales/questions/person1_age.rb
  8. 31
      app/models/form/sales/questions/person1_age_known.rb
  9. 16
      app/models/form/sales/questions/person2_age.rb
  10. 31
      app/models/form/sales/questions/person2_age_known.rb
  11. 16
      app/models/form/sales/questions/person3_age.rb
  12. 31
      app/models/form/sales/questions/person3_age_known.rb
  13. 16
      app/models/form/sales/questions/person4_age.rb
  14. 31
      app/models/form/sales/questions/person4_age_known.rb
  15. 23
      app/models/form/sales/questions/person_age.rb
  16. 38
      app/models/form/sales/questions/person_age_known.rb
  17. 12
      app/models/form/sales/subsections/household_characteristics.rb
  18. 37
      spec/models/form/sales/pages/person1_age_spec.rb
  19. 35
      spec/models/form/sales/pages/person2_age_spec.rb
  20. 35
      spec/models/form/sales/pages/person3_age_spec.rb
  21. 35
      spec/models/form/sales/pages/person4_age_spec.rb
  22. 185
      spec/models/form/sales/pages/person_age_spec.rb
  23. 69
      spec/models/form/sales/questions/person1_age_known_spec.rb
  24. 52
      spec/models/form/sales/questions/person1_age_spec.rb
  25. 62
      spec/models/form/sales/questions/person2_age_known_spec.rb
  26. 52
      spec/models/form/sales/questions/person2_age_spec.rb
  27. 62
      spec/models/form/sales/questions/person3_age_known_spec.rb
  28. 52
      spec/models/form/sales/questions/person3_age_spec.rb
  29. 62
      spec/models/form/sales/questions/person4_age_known_spec.rb
  30. 52
      spec/models/form/sales/questions/person4_age_spec.rb
  31. 400
      spec/models/form/sales/questions/person_age_known_spec.rb
  32. 285
      spec/models/form/sales/questions/person_age_spec.rb
  33. 4
      spec/models/form/sales/subsections/household_characteristics_spec.rb
  34. 4
      spec/models/form_handler_spec.rb

6
app/components/check_answers_summary_list_card_component.html.erb

@ -1,4 +1,5 @@
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> <% if applicable_questions.first %>
<div class="x-govuk-summary-card govuk-!-margin-bottom-6">
<% if applicable_questions.first.check_answers_card_number != 0 && applicable_questions.first.check_answers_card_number.present? %> <% if applicable_questions.first.check_answers_card_number != 0 && applicable_questions.first.check_answers_card_number.present? %>
<div class="x-govuk-summary-card__header"> <div class="x-govuk-summary-card__header">
<% if applicable_questions.first.check_answers_card_number == 1 %> <% if applicable_questions.first.check_answers_card_number == 1 %>
@ -36,4 +37,5 @@
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
</div> </div>
<% end %>

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

@ -1,19 +0,0 @@
class Form::Sales::Pages::Person1Age < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "person_1_age"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{ "details_known_1" => 1 },
]
end
def questions
@questions ||= [
Form::Sales::Questions::Person1AgeKnown.new(nil, nil, self),
Form::Sales::Questions::Person1Age.new(nil, nil, self),
]
end
end

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

@ -1,19 +0,0 @@
class Form::Sales::Pages::Person2Age < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "person_2_age"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{ "details_known_2" => 1 },
]
end
def questions
@questions ||= [
Form::Sales::Questions::Person2AgeKnown.new(nil, nil, self),
Form::Sales::Questions::Person2Age.new(nil, nil, self),
]
end
end

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

@ -1,19 +0,0 @@
class Form::Sales::Pages::Person3Age < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "person_3_age"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{ "details_known_3" => 1 },
]
end
def questions
@questions ||= [
Form::Sales::Questions::Person3AgeKnown.new(nil, nil, self),
Form::Sales::Questions::Person3Age.new(nil, nil, self),
]
end
end

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

@ -1,19 +0,0 @@
class Form::Sales::Pages::Person4Age < ::Form::Page
def initialize(id, hsh, subsection)
super
@id = "person_4_age"
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{ "details_known_4" => 1 },
]
end
def questions
@questions ||= [
Form::Sales::Questions::Person4AgeKnown.new(nil, nil, self),
Form::Sales::Questions::Person4Age.new(nil, nil, self),
]
end
end

29
app/models/form/sales/pages/person_age.rb

@ -0,0 +1,29 @@
class Form::Sales::Pages::PersonAge < ::Form::Page
def initialize(id, hsh, subsection)
super
@header = ""
@description = ""
@subsection = subsection
@depends_on = [
{ "details_known_#{person_display_number(PERSON_INDEX)}" => 1, "jointpur" => joint_purchase? ? 1 : 2 },
]
end
PERSON_INDEX = {
"person_1_age" => 2,
"person_2_age" => 3,
"person_3_age" => 4,
"person_4_age" => 5,
"person_1_age_joint_purchase" => 3,
"person_2_age_joint_purchase" => 4,
"person_3_age_joint_purchase" => 5,
"person_4_age_joint_purchase" => 6,
}.freeze
def questions
@questions ||= [
Form::Sales::Questions::PersonAgeKnown.new("age#{person_database_number(PERSON_INDEX)}_known", nil, self),
Form::Sales::Questions::PersonAge.new("age#{person_database_number(PERSON_INDEX)}", nil, self),
]
end
end

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

@ -1,16 +0,0 @@
class Form::Sales::Questions::Person1Age < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age3"
@check_answer_label = "Person 1’s age"
@header = "Age"
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age3_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 3
end
end

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

@ -1,31 +0,0 @@
class Form::Sales::Questions::Person1AgeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age3_known"
@check_answer_label = "Person 1’s age known?"
@header = "Do you know person 1’s age?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = ""
@conditional_for = {
"age3" => [0],
}
@hidden_in_check_answers = {
"depends_on" => [
{
"age3_known" => 0,
},
{
"age3_known" => 1,
},
],
}
@check_answers_card_number = 3
end
ANSWER_OPTIONS = {
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
}.freeze
end

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

@ -1,16 +0,0 @@
class Form::Sales::Questions::Person2Age < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age4"
@check_answer_label = "Person 2’s age"
@header = "Age"
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age4_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 4
end
end

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

@ -1,31 +0,0 @@
class Form::Sales::Questions::Person2AgeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age4_known"
@check_answer_label = "Person 2’s age known?"
@header = "Do you know person 2’s age?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = ""
@conditional_for = {
"age4" => [0],
}
@hidden_in_check_answers = {
"depends_on" => [
{
"age4_known" => 0,
},
{
"age4_known" => 1,
},
],
}
@check_answers_card_number = 4
end
ANSWER_OPTIONS = {
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
}.freeze
end

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

@ -1,16 +0,0 @@
class Form::Sales::Questions::Person3Age < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age5"
@check_answer_label = "Person 3’s age"
@header = "Age"
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age5_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 5
end
end

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

@ -1,31 +0,0 @@
class Form::Sales::Questions::Person3AgeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age5_known"
@check_answer_label = "Person 3’s age known?"
@header = "Do you know person 3’s age?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = ""
@conditional_for = {
"age5" => [0],
}
@hidden_in_check_answers = {
"depends_on" => [
{
"age5_known" => 0,
},
{
"age5_known" => 1,
},
],
}
@check_answers_card_number = 5
end
ANSWER_OPTIONS = {
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
}.freeze
end

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

@ -1,16 +0,0 @@
class Form::Sales::Questions::Person4Age < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age6"
@check_answer_label = "Person 4’s age"
@header = "Age"
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age6_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = 6
end
end

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

@ -1,31 +0,0 @@
class Form::Sales::Questions::Person4AgeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@id = "age6_known"
@check_answer_label = "Person 4’s age known?"
@header = "Do you know person 4’s age?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = ""
@conditional_for = {
"age6" => [0],
}
@hidden_in_check_answers = {
"depends_on" => [
{
"age6_known" => 0,
},
{
"age6_known" => 1,
},
],
}
@check_answers_card_number = 6
end
ANSWER_OPTIONS = {
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
}.freeze
end

23
app/models/form/sales/questions/person_age.rb

@ -0,0 +1,23 @@
class Form::Sales::Questions::PersonAge < ::Form::Question
def initialize(id, hsh, page)
super
@check_answer_label = "Person #{person_display_number(PERSON_INDEX)}’s age"
@header = "Age"
@type = "numeric"
@page = page
@width = 3
@inferred_check_answers_value = {
"condition" => { "age#{person_database_number(PERSON_INDEX)}_known" => 1 },
"value" => "Not known",
}
@check_answers_card_number = person_database_number(PERSON_INDEX)
end
PERSON_INDEX = {
"age2" => 2,
"age3" => 3,
"age4" => 4,
"age5" => 5,
"age6" => 6,
}.freeze
end

38
app/models/form/sales/questions/person_age_known.rb

@ -0,0 +1,38 @@
class Form::Sales::Questions::PersonAgeKnown < ::Form::Question
def initialize(id, hsh, page)
super
@check_answer_label = "Person #{person_display_number(PERSON_INDEX)}’s age known?"
@header = "Do you know person #{person_display_number(PERSON_INDEX)}’s age?"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@page = page
@hint_text = ""
@conditional_for = {
"age#{person_database_number(PERSON_INDEX)}" => [0],
}
@hidden_in_check_answers = {
"depends_on" => [
{
"age#{person_database_number(PERSON_INDEX)}_known" => 0,
},
{
"age#{person_database_number(PERSON_INDEX)}_known" => 1,
},
],
}
@check_answers_card_number = person_database_number(PERSON_INDEX)
end
ANSWER_OPTIONS = {
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
}.freeze
PERSON_INDEX = {
"age2_known" => 2,
"age3_known" => 3,
"age4_known" => 4,
"age5_known" => 5,
"age6_known" => 6,
}.freeze
end

12
app/models/form/sales/subsections/household_characteristics.rb

@ -30,21 +30,25 @@ class Form::Sales::Subsections::HouseholdCharacteristics < ::Form::Subsection
Form::Sales::Pages::Buyer2LiveInProperty.new(nil, nil, self), Form::Sales::Pages::Buyer2LiveInProperty.new(nil, nil, self),
Form::Sales::Pages::NumberOfOthersInProperty.new(nil, nil, self), Form::Sales::Pages::NumberOfOthersInProperty.new(nil, nil, self),
Form::Sales::Pages::Person1Known.new(nil, nil, self), Form::Sales::Pages::Person1Known.new(nil, nil, self),
Form::Sales::Pages::Person1Age.new(nil, nil, self), Form::Sales::Pages::PersonAge.new("person_1_age", nil, self),
Form::Sales::Pages::PersonAge.new("person_1_age_joint_purchase", nil, self),
Form::Sales::Pages::Person1GenderIdentity.new(nil, nil, self), Form::Sales::Pages::Person1GenderIdentity.new(nil, nil, self),
Form::Sales::Pages::Person1GenderIdentityJointPurchase.new(nil, nil, self), Form::Sales::Pages::Person1GenderIdentityJointPurchase.new(nil, nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_1_working_situation", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_1_working_situation", nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_1_working_situation_joint_purchase", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_1_working_situation_joint_purchase", nil, self),
Form::Sales::Pages::Person2Known.new(nil, nil, self), Form::Sales::Pages::Person2Known.new(nil, nil, self),
Form::Sales::Pages::Person2Age.new(nil, nil, self), Form::Sales::Pages::PersonAge.new("person_2_age", nil, self),
Form::Sales::Pages::PersonAge.new("person_2_age_joint_purchase", nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_2_working_situation", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_2_working_situation", nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_2_working_situation_joint_purchase", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_2_working_situation_joint_purchase", nil, self),
Form::Sales::Pages::Person3Known.new(nil, nil, self), Form::Sales::Pages::Person3Known.new(nil, nil, self),
Form::Sales::Pages::Person3Age.new(nil, nil, self), Form::Sales::Pages::PersonAge.new("person_3_age", nil, self),
Form::Sales::Pages::PersonAge.new("person_3_age_joint_purchase", nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_3_working_situation", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_3_working_situation", nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_3_working_situation_joint_purchase", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_3_working_situation_joint_purchase", nil, self),
Form::Sales::Pages::Person4Known.new(nil, nil, self), Form::Sales::Pages::Person4Known.new(nil, nil, self),
Form::Sales::Pages::Person4Age.new(nil, nil, self), Form::Sales::Pages::PersonAge.new("person_4_age", nil, self),
Form::Sales::Pages::PersonAge.new("person_4_age_joint_purchase", nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_4_working_situation", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_4_working_situation", nil, self),
Form::Sales::Pages::PersonWorkingSituation.new("person_4_working_situation_joint_purchase", nil, self), Form::Sales::Pages::PersonWorkingSituation.new("person_4_working_situation_joint_purchase", nil, self),
] ]

37
spec/models/form/sales/pages/person1_age_spec.rb

@ -1,37 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Person1Age, 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[age3_known age3])
end
it "has the correct id" do
expect(page.id).to eq("person_1_age")
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 eq(
[
{ "details_known_1" => 1 },
],
)
end
end

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

@ -1,35 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Person2Age, 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[age4_known age4])
end
it "has the correct id" do
expect(page.id).to eq("person_2_age")
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 eq(
[{ "details_known_2" => 1 }],
)
end
end

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

@ -1,35 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Person3Age, 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[age5_known age5])
end
it "has the correct id" do
expect(page.id).to eq("person_3_age")
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 eq(
[{ "details_known_3" => 1 }],
)
end
end

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

@ -1,35 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::Person4Age, 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[age6_known age6])
end
it "has the correct id" do
expect(page.id).to eq("person_4_age")
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 eq(
[{ "details_known_4" => 1 }],
)
end
end

185
spec/models/form/sales/pages/person_age_spec.rb

@ -0,0 +1,185 @@
require "rails_helper"
RSpec.describe Form::Sales::Pages::PersonAge, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { "person_1_age" }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
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
context "with a non joint purchase" do
context "and person 1" do
let(:page_id) { "person_1_age" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age2_known age2])
end
it "has the correct id" do
expect(page.id).to eq("person_1_age")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_1" => 1, "jointpur" => 2 },
],
)
end
end
context "and person 2" do
let(:page_id) { "person_2_age" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age3_known age3])
end
it "has the correct id" do
expect(page.id).to eq("person_2_age")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_2" => 1, "jointpur" => 2 },
],
)
end
end
context "and person 3" do
let(:page_id) { "person_3_age" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age4_known age4])
end
it "has the correct id" do
expect(page.id).to eq("person_3_age")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_3" => 1, "jointpur" => 2 },
],
)
end
end
context "and person 4" do
let(:page_id) { "person_4_age" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age5_known age5])
end
it "has the correct id" do
expect(page.id).to eq("person_4_age")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_4" => 1, "jointpur" => 2 },
],
)
end
end
end
context "with joint purchase" do
context "and person 1" do
let(:page_id) { "person_1_age_joint_purchase" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age3_known age3])
end
it "has the correct id" do
expect(page.id).to eq("person_1_age_joint_purchase")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_1" => 1, "jointpur" => 1 },
],
)
end
end
context "and person 2" do
let(:page_id) { "person_2_age_joint_purchase" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age4_known age4])
end
it "has the correct id" do
expect(page.id).to eq("person_2_age_joint_purchase")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_2" => 1, "jointpur" => 1 },
],
)
end
end
context "and person 3" do
let(:page_id) { "person_3_age_joint_purchase" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age5_known age5])
end
it "has the correct id" do
expect(page.id).to eq("person_3_age_joint_purchase")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_3" => 1, "jointpur" => 1 },
],
)
end
end
context "and person 4" do
let(:page_id) { "person_4_age_joint_purchase" }
it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[age6_known age6])
end
it "has the correct id" do
expect(page.id).to eq("person_4_age_joint_purchase")
end
it "has correct depends_on" do
expect(page.depends_on).to eq(
[
{ "details_known_4" => 1, "jointpur" => 1 },
],
)
end
end
end
end

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

@ -1,69 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person1AgeKnown, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age3_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 1’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 1’s age known?")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
})
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age3" => [0],
})
end
it "has the correct hint" do
expect(question.hint_text).to eq("")
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"depends_on" => [
{
"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

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

@ -1,52 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person1Age, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age3")
end
it "has the correct header" do
expect(question.header).to eq("Age")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 1’s age")
end
it "has the correct type" do
expect(question.type).to eq("numeric")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint" do
expect(question.hint_text).to be_nil
end
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

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

@ -1,62 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person2AgeKnown, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age4_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 2’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 2’s age known?")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
})
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age4" => [0],
})
end
it "has the correct hint" do
expect(question.hint_text).to eq("")
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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

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

@ -1,52 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person2Age, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age4")
end
it "has the correct header" do
expect(question.header).to eq("Age")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 2’s age")
end
it "has the correct type" do
expect(question.type).to eq("numeric")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint" do
expect(question.hint_text).to be_nil
end
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

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

@ -1,62 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person3AgeKnown, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age5_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 3’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 3’s age known?")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
})
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age5" => [0],
})
end
it "has the correct hint" do
expect(question.hint_text).to eq("")
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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

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

@ -1,52 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person3Age, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age5")
end
it "has the correct header" do
expect(question.header).to eq("Age")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 3’s age")
end
it "has the correct type" do
expect(question.type).to eq("numeric")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint" do
expect(question.hint_text).to be_nil
end
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

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

@ -1,62 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person4AgeKnown, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age6_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 4’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 4’s age known?")
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
})
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age6" => [0],
})
end
it "has the correct hint" do
expect(question.hint_text).to eq("")
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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

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

@ -1,52 +0,0 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::Person4Age, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct id" do
expect(question.id).to eq("age6")
end
it "has the correct header" do
expect(question.header).to eq("Age")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 4’s age")
end
it "has the correct type" do
expect(question.type).to eq("numeric")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint" do
expect(question.hint_text).to be_nil
end
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

400
spec/models/form/sales/questions/person_age_known_spec.rb

@ -0,0 +1,400 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::PersonAgeKnown, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { "age3_known" }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
before do
allow(page).to receive(:id).and_return("person_1_age")
end
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct type" do
expect(question.type).to eq("radio")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"0" => { "value" => "Yes" },
"1" => { "value" => "No" },
})
end
it "has the correct hint" do
expect(question.hint_text).to eq("")
end
context "with a non joint purchase" do
context "and person 1" do
let(:question_id) { "age2_known" }
before do
allow(page).to receive(:id).and_return("person_1_age")
end
it "has the correct id" do
expect(question.id).to eq("age2_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 1’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 1’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age2" => [0],
})
end
it "has the 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
context "and person 2" do
let(:question_id) { "age3_known" }
before do
allow(page).to receive(:id).and_return("person_2_age")
end
it "has the correct id" do
expect(question.id).to eq("age3_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 2’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 2’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age3" => [0],
})
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"depends_on" => [
{
"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
context "and person 3" do
let(:question_id) { "age4_known" }
before do
allow(page).to receive(:id).and_return("person_3_age")
end
it "has the correct id" do
expect(question.id).to eq("age4_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 3’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 3’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age4" => [0],
})
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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
context "and person 4" do
let(:question_id) { "age5_known" }
before do
allow(page).to receive(:id).and_return("person_4_age")
end
it "has the correct id" do
expect(question.id).to eq("age5_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 4’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 4’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age5" => [0],
})
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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
end
context "with a joint purchase" do
context "and person 1" do
let(:question_id) { "age3_known" }
before do
allow(page).to receive(:id).and_return("person_1_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age3_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 1’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 1’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age3" => [0],
})
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"depends_on" => [
{
"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
context "and person 2" do
let(:question_id) { "age4_known" }
before do
allow(page).to receive(:id).and_return("person_2_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age4_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 2’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 2’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age4" => [0],
})
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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
context "and person 3" do
let(:question_id) { "age5_known" }
before do
allow(page).to receive(:id).and_return("person_3_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age5_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 3’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 3’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age5" => [0],
})
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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
context "and person 4" do
let(:question_id) { "age6_known" }
before do
allow(page).to receive(:id).and_return("person_4_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age6_known")
end
it "has the correct header" do
expect(question.header).to eq("Do you know person 4’s age?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 4’s age known?")
end
it "has correct conditional for" do
expect(question.conditional_for).to eq({
"age6" => [0],
})
end
it "has the correct hidden_in_check_answers" do
expect(question.hidden_in_check_answers).to eq(
{
"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
end
end

285
spec/models/form/sales/questions/person_age_spec.rb

@ -0,0 +1,285 @@
require "rails_helper"
RSpec.describe Form::Sales::Questions::PersonAge, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { "age3" }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
before do
allow(page).to receive(:id).and_return("person_1_age")
end
it "has correct page" do
expect(question.page).to eq(page)
end
it "has the correct header" do
expect(question.header).to eq("Age")
end
it "has the correct type" do
expect(question.type).to eq("numeric")
end
it "is not marked as derived" do
expect(question.derived?).to be false
end
it "has the correct hint" do
expect(question.hint_text).to be_nil
end
context "with not a joint purchase" do
context "and person 1" do
let(:question_id) { "age2" }
before do
allow(page).to receive(:id).and_return("person_1_age")
end
it "has the correct id" do
expect(question.id).to eq("age2")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 1’s age")
end
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" => { "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
context "and person 2" do
let(:question_id) { "age3" }
before do
allow(page).to receive(:id).and_return("person_2_age")
end
it "has the correct id" do
expect(question.id).to eq("age3")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 2’s age")
end
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
context "and person 3" do
let(:question_id) { "age4" }
before do
allow(page).to receive(:id).and_return("person_3_age")
end
it "has the correct id" do
expect(question.id).to eq("age4")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 3’s age")
end
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
context "and person 4" do
let(:question_id) { "age5" }
before do
allow(page).to receive(:id).and_return("person_4_age")
end
it "has the correct id" do
expect(question.id).to eq("age5")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 4’s age")
end
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
end
context "with a joint purchase" do
context "and person 1" do
let(:question_id) { "age3" }
before do
allow(page).to receive(:id).and_return("person_1_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age3")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 1’s age")
end
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
context "and person 2" do
let(:question_id) { "age4" }
before do
allow(page).to receive(:id).and_return("person_2_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age4")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 2’s age")
end
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
context "and person 3" do
let(:question_id) { "age5" }
before do
allow(page).to receive(:id).and_return("person_3_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age5")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 3’s age")
end
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
context "and person 4" do
let(:question_id) { "age6" }
before do
allow(page).to receive(:id).and_return("person_4_age_joint_purchase")
end
it "has the correct id" do
expect(question.id).to eq("age6")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Person 4’s age")
end
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
end
end

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

@ -36,20 +36,24 @@ RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model
number_of_others_in_property number_of_others_in_property
person_1_known person_1_known
person_1_age person_1_age
person_1_age_joint_purchase
person_1_gender_identity person_1_gender_identity
person_1_gender_identity_joint_purchase person_1_gender_identity_joint_purchase
person_1_working_situation person_1_working_situation
person_1_working_situation_joint_purchase person_1_working_situation_joint_purchase
person_2_known person_2_known
person_2_age person_2_age
person_2_age_joint_purchase
person_2_working_situation person_2_working_situation
person_2_working_situation_joint_purchase person_2_working_situation_joint_purchase
person_3_known person_3_known
person_3_age person_3_age
person_3_age_joint_purchase
person_3_working_situation person_3_working_situation
person_3_working_situation_joint_purchase person_3_working_situation_joint_purchase
person_4_known person_4_known
person_4_age person_4_age
person_4_age_joint_purchase
person_4_working_situation person_4_working_situation
person_4_working_situation_joint_purchase person_4_working_situation_joint_purchase
], ],

4
spec/models/form_handler_spec.rb

@ -52,14 +52,14 @@ RSpec.describe FormHandler do
it "is able to load a current sales form" do it "is able to load a current sales form" do
form = form_handler.get_form("current_sales") form = form_handler.get_form("current_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(64) expect(form.pages.count).to eq(68)
expect(form.name).to eq("2022_2023_sales") expect(form.name).to eq("2022_2023_sales")
end end
it "is able to load a previous sales form" do it "is able to load a previous sales form" do
form = form_handler.get_form("previous_sales") form = form_handler.get_form("previous_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(64) expect(form.pages.count).to eq(68)
expect(form.name).to eq("2021_2022_sales") expect(form.name).to eq("2021_2022_sales")
end end
end end

Loading…
Cancel
Save