Browse Source

alter har dmax value for number of other people in the property, change a couple of depends on formulations to improve readability

pull/1452/head
Arthur Campbell 3 years ago
parent
commit
052db62904
  1. 6
      app/models/form/sales/pages/number_of_others_in_property.rb
  2. 4
      app/models/form/sales/questions/number_of_others_in_property.rb
  3. 12
      spec/models/form/sales/pages/number_of_others_in_property_spec.rb
  4. 12
      spec/models/form/sales/questions/number_of_others_in_property_spec.rb

6
app/models/form/sales/pages/number_of_others_in_property.rb

@ -4,11 +4,11 @@ class Form::Sales::Pages::NumberOfOthersInProperty < ::Form::Page
@depends_on = [
{
"privacynotice" => 1,
"jointpur" => joint_purchase ? 1 : 2,
"joint_purchase?" => joint_purchase,
},
{
"noint" => 1,
"jointpur" => joint_purchase ? 1 : 2,
"buyer_not_interviewed?" => true,
"joint_purchase?" => joint_purchase,
},
]
@joint_purchase = joint_purchase

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

@ -3,12 +3,12 @@ class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question
super(id, hsh, page)
@id = "hholdcount"
@check_answer_label = "Number of other people living in the property"
@header = "Besides the buyer(s), how many other people live or will live in the property?"
@header = "Besides the #{"buyer".pluralize(joint_purchase ? 2 : 1)}, how many other people live or will live in the property?"
@type = "numeric"
@hint_text = hint(joint_purchase)
@width = 2
@min = 0
@max = joint_purchase ? 4 : 5
@max = 15
@question_number = 35
end

12
spec/models/form/sales/pages/number_of_others_in_property_spec.rb

@ -32,11 +32,11 @@ RSpec.describe Form::Sales::Pages::NumberOfOthersInProperty, type: :model do
expect(page.depends_on).to eq([
{
"privacynotice" => 1,
"jointpur" => 2,
"joint_purchase?" => joint_purchase,
},
{
"noint" => 1,
"jointpur" => 2,
"buyer_not_interviewed?" => true,
"joint_purchase?" => joint_purchase,
},
])
end
@ -53,11 +53,11 @@ RSpec.describe Form::Sales::Pages::NumberOfOthersInProperty, type: :model do
expect(page.depends_on).to eq([
{
"privacynotice" => 1,
"jointpur" => 1,
"joint_purchase?" => joint_purchase,
},
{
"noint" => 1,
"jointpur" => 1,
"buyer_not_interviewed?" => true,
"joint_purchase?" => joint_purchase,
},
])
end

12
spec/models/form/sales/questions/number_of_others_in_property_spec.rb

@ -9,7 +9,7 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do
let(:joint_purchase) { true }
it "has correct page" do
expect(question.page).to eq(page)
expect(question.page).to be(page)
end
it "has the correct id" do
@ -17,7 +17,7 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do
end
it "has the correct header" do
expect(question.header).to eq("Besides the buyer(s), how many other people live or will live in the property?")
expect(question.header).to eq("Besides the buyers, how many other people live or will live in the property?")
end
it "has the correct check_answer_label" do
@ -37,11 +37,11 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do
end
it "has the correct min" do
expect(question.min).to eq(0)
expect(question.min).to be 0
end
it "has the correct max" do
expect(question.max).to eq(4)
expect(question.max).to be 15
end
context "with non joint purchase" do
@ -51,8 +51,8 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do
expect(question.hint_text).to eq("You can provide details for a maximum of 5 other people if there is only one buyer.")
end
it "has the correct max" do
expect(question.max).to eq(5)
it "has the correct header" do
expect(question.header).to eq("Besides the buyer, how many other people live or will live in the property?")
end
end
end

Loading…
Cancel
Save