Browse Source

update hint text

pull/1297/head
Kat 3 years ago
parent
commit
d0678bb6c9
  1. 12
      app/models/form/sales/questions/number_of_others_in_property.rb
  2. 4
      spec/models/form/sales/questions/number_of_others_in_property_spec.rb

12
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" @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(s), how many other people live or will live in the property?"
@type = "numeric" @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 @width = 2
@min = 0 @min = 0
@max = joint_purchase ? 4 : 5 @max = joint_purchase ? 4 : 5
end 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 end

4
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 end
it "has the correct hint" do 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 end
it "has the correct min" do it "has the correct min" do
@ -48,7 +48,7 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do
let(:joint_purchase) { false } let(:joint_purchase) { false }
it "has the correct hint" do 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 end
it "has the correct max" do it "has the correct max" do

Loading…
Cancel
Save