From e05d948bfb94fa2e255d0116489673aacfa6de63 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Fri, 26 Jan 2024 11:13:27 +0000 Subject: [PATCH] Update ownership answer option hint (#2174) --- .../form/sales/questions/ownership_scheme.rb | 21 +++++++++++++----- .../sales/questions/ownership_scheme_spec.rb | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/models/form/sales/questions/ownership_scheme.rb b/app/models/form/sales/questions/ownership_scheme.rb index dc1d4fb29..d4c29e625 100644 --- a/app/models/form/sales/questions/ownership_scheme.rb +++ b/app/models/form/sales/questions/ownership_scheme.rb @@ -5,13 +5,22 @@ class Form::Sales::Questions::OwnershipScheme < ::Form::Question @check_answer_label = "Purchase made under ownership scheme" @header = "Was this purchase made through an ownership scheme?" @type = "radio" - @answer_options = ANSWER_OPTIONS @question_number = 3 end - ANSWER_OPTIONS = { - "1" => { "value" => "Yes - a shared ownership scheme" }, - "2" => { "value" => "Yes - a discounted ownership scheme" }, - "3" => { "value" => "No - this is an outright or other sale" }, - }.freeze + def answer_options + if form.start_year_after_2024? + { + "1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" }, + "2" => { "value" => "Yes - a discounted ownership scheme" }, + "3" => { "value" => "No - this is an outright or other sale" }, + }.freeze + else + { + "1" => { "value" => "Yes - a shared ownership scheme" }, + "2" => { "value" => "Yes - a discounted ownership scheme" }, + "3" => { "value" => "No - this is an outright or other sale" }, + }.freeze + end + end end diff --git a/spec/models/form/sales/questions/ownership_scheme_spec.rb b/spec/models/form/sales/questions/ownership_scheme_spec.rb index f21baeab3..ec104682b 100644 --- a/spec/models/form/sales/questions/ownership_scheme_spec.rb +++ b/spec/models/form/sales/questions/ownership_scheme_spec.rb @@ -6,6 +6,14 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do let(:question_id) { nil } let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form) } + + before do + allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + end it "has correct page" do expect(question.page).to eq(page) @@ -38,4 +46,18 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do "3" => { "value" => "No - this is an outright or other sale" }, }) end + + context "with collection year on or after 2024" do + before do + allow(form).to receive(:start_year_after_2024?).and_return(true) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Yes - a shared ownership scheme", "hint" => "When the purchaser buys an initial share of up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion, or a subsequent staircasing transaction" }, + "2" => { "value" => "Yes - a discounted ownership scheme" }, + "3" => { "value" => "No - this is an outright or other sale" }, + }) + end + end end