Browse Source

Update nationality hint text (#2225)

pull/2234/head
kosiakkatrina 11 months ago committed by GitHub
parent
commit
cc8ba09b92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      app/models/form/lettings/questions/nationality_all_group.rb
  2. 9
      app/models/form/sales/questions/nationality_all_group.rb
  3. 2
      spec/models/form/lettings/questions/nationality_all_group_spec.rb
  4. 4
      spec/models/form/sales/questions/nationality_all_group_spec.rb

2
app/models/form/lettings/questions/nationality_all_group.rb

@ -6,7 +6,7 @@ class Form::Lettings::Questions::NationalityAllGroup < ::Form::Question
@header = "What is the nationality of the lead tenant?"
@type = "radio"
@check_answers_card_number = 1
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest."
@hint_text = "The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest. If the lead tenant is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the tenant should decide which country to enter."
@answer_options = ANSWER_OPTIONS
@question_number = 36
@conditional_for = { "nationality_all" => [12] }

9
app/models/form/sales/questions/nationality_all_group.rb

@ -10,6 +10,7 @@ class Form::Sales::Questions::NationalityAllGroup < ::Form::Question
@question_number = buyer_index == 1 ? 24 : 32
@conditional_for = buyer_index == 1 ? { "nationality_all" => [12] } : { "nationality_all_buyer2" => [12] }
@hidden_in_check_answers = { "depends_on" => [{ id => 12 }] }
@buyer_index = buyer_index
end
ANSWER_OPTIONS = {
@ -17,4 +18,12 @@ class Form::Sales::Questions::NationalityAllGroup < ::Form::Question
"12" => { "value" => "Other" },
"0" => { "value" => "Buyer prefers not to say" },
}.freeze
def hint_text
if @buyer_index == 1
"Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest. If buyer 1 is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the buyer should decide which country to enter."
else
"If buyer 2 is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the buyer should decide which country to enter."
end
end
end

2
spec/models/form/lettings/questions/nationality_all_group_spec.rb

@ -26,7 +26,7 @@ RSpec.describe Form::Lettings::Questions::NationalityAllGroup, type: :model do
end
it "has the correct hint_text" do
expect(question.hint_text).to eq("The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest.")
expect(question.hint_text).to eq("The lead tenant is the person in the household who does the most paid work. If several people do the same paid work, the lead tenant is whoever is the oldest. If the lead tenant is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the tenant should decide which country to enter.")
end
it "has the correct answer_options" do

4
spec/models/form/sales/questions/nationality_all_group_spec.rb

@ -47,7 +47,7 @@ RSpec.describe Form::Sales::Questions::NationalityAllGroup, type: :model do
end
it "has the correct hint" do
expect(question.hint_text).to eq "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest."
expect(question.hint_text).to eq "Buyer 1 is the person in the household who does the most paid work. If it’s a joint purchase and the buyers do the same amount of paid work, buyer 1 is whoever is the oldest. If buyer 1 is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the buyer should decide which country to enter."
end
it "has the correct header" do
@ -75,7 +75,7 @@ RSpec.describe Form::Sales::Questions::NationalityAllGroup, type: :model do
end
it "has the correct hint" do
expect(question.hint_text).to eq("")
expect(question.hint_text).to eq "If buyer 2 is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the buyer should decide which country to enter."
end
it "has the correct header" do

Loading…
Cancel
Save