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 a588a8c8d..97a873430 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 @@ -5,9 +5,19 @@ class Form::Sales::Questions::NumberOfOthersInProperty < ::Form::Question @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?" @type = "numeric" - @hint_text = "You can provide details for a maximum of #{joint_purchase ? '4' : '5'} other people." + @hint_text = hint(joint_purchase) @width = 2 @min = 0 @max = joint_purchase ? 4 : 5 end + +private + + def hint(joint_purchase) + if joint_purchase + "You can provide details for a maximum of 4 other people for a joint purchase." + else + "You can provide details for a maximum of 5 other people if there is only one buyer." + end + end 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 92e41cff7..2bb50f80b 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 @@ -33,7 +33,7 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do end it "has the correct hint" do - expect(question.hint_text).to eq("You can provide details for a maximum of 4 other people.") + expect(question.hint_text).to eq("You can provide details for a maximum of 4 other people for a joint purchase.") end it "has the correct min" do @@ -48,7 +48,7 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do let(:joint_purchase) { false } it "has the correct hint" do - expect(question.hint_text).to eq("You can provide details for a maximum of 5 other people.") + 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