Browse Source

CLDC-4309: Add copy for staircasing transaction mortgage used (#3251)

* CLDC-4309: Add copy for staircasing transaction mortgage used

* CLDC-4309: Update tests
pull/3264/head
Samuel Young 4 days ago committed by GitHub
parent
commit
328ea6272b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      app/models/form/sales/questions/mortgageused.rb
  2. 14
      config/locales/forms/2026/sales/sale_information.en.yml
  3. 30
      spec/models/form/sales/questions/mortgageused_spec.rb

6
app/models/form/sales/questions/mortgageused.rb

@ -6,6 +6,12 @@ class Form::Sales::Questions::Mortgageused < ::Form::Question
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@ownershipsch = ownershipsch @ownershipsch = ownershipsch
@question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR_AND_SECTION, value_key: form.start_year_2025_or_later? ? subsection.id : ownershipsch) @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR_AND_SECTION, value_key: form.start_year_2025_or_later? ? subsection.id : ownershipsch)
sub_copy_key = if subsection.id == "shared_ownership_staircasing_transaction"
"staircase_equity"
else
"non_staircase_equity"
end
@copy_key = "#{form.type}.#{subsection.copy_key}.#{@id}.#{sub_copy_key}" if form.start_year_2026_or_later?
@top_guidance_partial = top_guidance_partial @top_guidance_partial = top_guidance_partial
end end

14
config/locales/forms/2026/sales/sale_information.en.yml

@ -171,10 +171,16 @@ en:
mortgageused: mortgageused:
page_header: "" page_header: ""
check_answer_label: "Mortgage used" staircase_equity:
check_answer_prompt: "Tell us if a mortgage was used" check_answer_label: "Mortgage used"
hint_text: "" check_answer_prompt: "Tell us if a mortgage was used"
question_text: "Was a mortgage used for the purchase of this property?" hint_text: ""
question_text: "Was a mortgage used for this staircasing transaction?"
non_staircase_equity:
check_answer_label: "Mortgage used"
check_answer_prompt: "Tell us if a mortgage was used"
hint_text: ""
question_text: "Was a mortgage used for the purchase of this property?"
mortgage: mortgage:
page_header: "" page_header: ""

30
spec/models/form/sales/questions/mortgageused_spec.rb

@ -15,8 +15,8 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do
let(:start_year_2025_or_later?) { true } let(:start_year_2025_or_later?) { true }
let(:start_year_2026_or_later?) { true } let(:start_year_2026_or_later?) { true }
let(:subsection_id) { "shared_ownership_initial_purchase" } let(:subsection_id) { "shared_ownership_initial_purchase" }
let(:form) { instance_double(Form, start_date: saledate, start_year_2024_or_later?: start_year_2024_or_later?, start_year_2025_or_later?: start_year_2025_or_later?, start_year_2026_or_later?: start_year_2026_or_later?) } let(:form) { instance_double(Form, type: "sales", start_date: saledate, start_year_2024_or_later?: start_year_2024_or_later?, start_year_2025_or_later?: start_year_2025_or_later?, start_year_2026_or_later?: start_year_2026_or_later?) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: subsection_id)) } let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form:, id: subsection_id, copy_key: subsection_id)) }
context "when it is a shared ownership scheme" do context "when it is a shared ownership scheme" do
let(:ownershipsch) { 1 } let(:ownershipsch) { 1 }
@ -120,6 +120,10 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do
expect(question.question_number).to eq 106 expect(question.question_number).to eq 106
end end
it "has the correct copy_key" do
expect(question.copy_key).to eq "sales.discounted_ownership_scheme.mortgageused"
end
it "does not show the don't know option" do it "does not show the don't know option" do
expect_the_question_not_to_show_dont_know expect_the_question_not_to_show_dont_know
end end
@ -134,6 +138,11 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do
context "and it is a staircasing transaction" do context "and it is a staircasing transaction" do
let(:staircase) { 1 } let(:staircase) { 1 }
let(:subsection_id) { "shared_ownership_staircasing_transaction" }
it "has the correct copy_key" do
expect(question.copy_key).to eq "sales.shared_ownership_staircasing_transaction.mortgageused"
end
it "shows the don't know option" do it "shows the don't know option" do
expect_the_question_to_show_dont_know expect_the_question_to_show_dont_know
@ -150,10 +159,15 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do
context "and it is not a staircasing transaction" do context "and it is not a staircasing transaction" do
let(:staircase) { 2 } let(:staircase) { 2 }
let(:subsection_id) { "shared_ownership_initial_purchase" }
it "does not show the don't know option" do it "does not show the don't know option" do
expect_the_question_not_to_show_dont_know expect_the_question_not_to_show_dont_know
end end
it "has the correct copy_key" do
expect(question.copy_key).to eq "sales.shared_ownership_initial_purchase.mortgageused"
end
end end
end end
end end
@ -169,6 +183,10 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do
expect(question.question_number).to eq 116 expect(question.question_number).to eq 116
end end
it "has the correct copy_key" do
expect(question.copy_key).to eq "sales.discounted_ownership_scheme.mortgageused.non_staircase_equity"
end
it "shows the don't know option" do it "shows the don't know option" do
expect_the_question_to_show_dont_know expect_the_question_to_show_dont_know
end end
@ -185,6 +203,10 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do
expect(question.question_number).to eq 107 expect(question.question_number).to eq 107
end end
it "has the correct copy_key" do
expect(question.copy_key).to eq "sales.shared_ownership_staircasing_transaction.mortgageused.staircase_equity"
end
it "shows the don't know option" do it "shows the don't know option" do
expect_the_question_to_show_dont_know expect_the_question_to_show_dont_know
end end
@ -198,6 +220,10 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do
expect(question.question_number).to eq 90 expect(question.question_number).to eq 90
end end
it "has the correct copy_key" do
expect(question.copy_key).to eq "sales.shared_ownership_initial_purchase.mortgageused.non_staircase_equity"
end
it "shows the don't know option" do it "shows the don't know option" do
expect_the_question_to_show_dont_know expect_the_question_to_show_dont_know
end end

Loading…
Cancel
Save