Browse Source

Extract old persons shared ownership confirmation questions

pull/2707/head
Kat 2 years ago
parent
commit
3d56ad29d1
  1. 5
      app/models/form/sales/pages/old_persons_shared_ownership_value_check.rb
  2. 3
      app/models/form/sales/questions/old_persons_shared_ownership_value_check.rb
  3. 5
      config/locales/en.yml
  4. 9
      config/locales/forms/2023/sales/soft_validations.en.yml
  5. 9
      config/locales/forms/2024/sales/soft_validations.en.yml
  6. 9
      spec/models/form/sales/pages/old_persons_shared_ownership_value_check_spec.rb

5
app/models/form/sales/pages/old_persons_shared_ownership_value_check.rb

@ -1,12 +1,13 @@
class Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck < ::Form::Page
def initialize(id, hsh, subsection, joint_purchase:)
super(id, hsh, subsection)
@copy_key = "sales.soft_validations.old_persons_shared_ownership_value_check"
@title_text = {
"translation" => "soft_validations.old_persons_shared_ownership.title_text.#{joint_purchase ? 'two' : 'one'}",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text.#{joint_purchase ? 'joint_purchase' : 'not_joint_purchase'}",
"arguments" => [],
}
@informative_text = {
"translation" => "soft_validations.old_persons_shared_ownership.hint_text",
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.informative_text",
"arguments" => [],
}
@joint_purchase = joint_purchase

3
app/models/form/sales/questions/old_persons_shared_ownership_value_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::OldPersonsSharedOwnershipValueCheck < ::Form::Ques
def initialize(id, hsh, page)
super
@id = "old_persons_shared_ownership_value_check"
@check_answer_label = "Shared ownership confirmation"
@header = "Are you sure this is correct?"
@copy_key = "sales.soft_validations.old_persons_shared_ownership_value_check"
@type = "interruption_screen"
@answer_options = {
"0" => { "value" => "Yes" },

5
config/locales/en.yml

@ -754,11 +754,6 @@ Make sure these answers are correct."
hint_text: "This is higher than we would expect."
shared_ownership_deposit:
title_text: "You told us that the %{mortgage_deposit_and_discount_error_fields} add up to %{mortgage_deposit_and_discount_total}."
old_persons_shared_ownership:
title_text:
one: "You told us the buyer is using the Older Persons Shared Ownership scheme."
two: "You told us the buyers are using the Older Persons Shared Ownership scheme."
hint_text: "At least one buyer must be aged 65 years and over to use this scheme."
staircase_bought_seems_high:
title_text: "You told us that %{percentage}% was bought in this staircasing transaction."
hint_text: "Most staircasing transactions are less than 50%"

9
config/locales/forms/2023/sales/soft_validations.en.yml

@ -18,4 +18,13 @@ en:
question_text: "Are you sure this person is retired?"
title_text: "You told us this person is aged %{age} years and retired."
informative_text: "The minimum expected retirement age in England is 66."
old_persons_shared_ownership_value_check:
age_header: ""
check_answer_label: "Shared ownership confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text:
joint_purchase: "You told us the buyers are using the Older Persons Shared Ownership scheme."
not_joint_purchase: "You told us the buyer is using the Older Persons Shared Ownership scheme."
informative_text: "At least one buyer must be aged 65 years and over to use this scheme."

9
config/locales/forms/2024/sales/soft_validations.en.yml

@ -18,4 +18,13 @@ en:
question_text: "Are you sure this person is retired?"
title_text: "You told us this person is aged %{age} years and retired."
informative_text: "The minimum expected retirement age in England is 66."
old_persons_shared_ownership_value_check:
age_header: ""
check_answer_label: "Shared ownership confirmation"
hint_text: ""
question_text: "Are you sure this is correct?"
title_text:
joint_purchase: "You told us the buyers are using the Older Persons Shared Ownership scheme."
not_joint_purchase: "You told us the buyer is using the Older Persons Shared Ownership scheme."
informative_text: "At least one buyer must be aged 65 years and over to use this scheme."

9
spec/models/form/sales/pages/old_persons_shared_ownership_value_check_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck, type: :m
let(:page_id) { "old_persons_shared_ownership_value_check" }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)
@ -34,13 +35,13 @@ RSpec.describe Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck, type: :m
it "has the correct title_text" do
expect(page.title_text).to eq({
"translation" => "soft_validations.old_persons_shared_ownership.title_text.one",
"translation" => "forms.2024.sales.soft_validations.old_persons_shared_ownership_value_check.title_text.not_joint_purchase",
"arguments" => [],
})
end
it "has the correct informative_text" do
expect(page.informative_text).to eq({ "arguments" => [], "translation" => "soft_validations.old_persons_shared_ownership.hint_text" })
expect(page.informative_text).to eq({ "arguments" => [], "translation" => "forms.2024.sales.soft_validations.old_persons_shared_ownership_value_check.informative_text" })
end
it "has the correct interruption_screen_question_ids" do
@ -52,7 +53,7 @@ RSpec.describe Form::Sales::Pages::OldPersonsSharedOwnershipValueCheck, type: :m
it "has the correct title_text" do
expect(page.title_text).to eq({
"translation" => "soft_validations.old_persons_shared_ownership.title_text.two",
"translation" => "forms.2024.sales.soft_validations.old_persons_shared_ownership_value_check.title_text.joint_purchase",
"arguments" => [],
})
end

Loading…
Cancel
Save