diff --git a/app/models/form/sales/pages/number_of_others_in_property.rb b/app/models/form/sales/pages/number_of_others_in_property.rb index ebf9817bd..4c6b9e621 100644 --- a/app/models/form/sales/pages/number_of_others_in_property.rb +++ b/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 diff --git a/app/models/form/sales/questions/number_of_others_in_property.rb b/app/models/form/sales/questions/number_of_others_in_property.rb index 44e7e5563..556ddf837 100644 --- a/app/models/form/sales/questions/number_of_others_in_property.rb +++ b/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 diff --git a/spec/models/form/sales/pages/number_of_others_in_property_spec.rb b/spec/models/form/sales/pages/number_of_others_in_property_spec.rb index 3503a1b9f..9a0adaafb 100644 --- a/spec/models/form/sales/pages/number_of_others_in_property_spec.rb +++ b/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 diff --git a/spec/models/form/sales/questions/number_of_others_in_property_spec.rb b/spec/models/form/sales/questions/number_of_others_in_property_spec.rb index 2bb50f80b..3d6e9d9c5 100644 --- a/spec/models/form/sales/questions/number_of_others_in_property_spec.rb +++ b/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