Browse Source

Update ownership answer option hint (#2174)

CLDC-3152-update-ppostcode-hint-for-23-24
kosiakkatrina 11 months ago committed by GitHub
parent
commit
e05d948bfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      app/models/form/sales/questions/ownership_scheme.rb
  2. 22
      spec/models/form/sales/questions/ownership_scheme_spec.rb

13
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" @check_answer_label = "Purchase made under ownership scheme"
@header = "Was this purchase made through an ownership scheme?" @header = "Was this purchase made through an ownership scheme?"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = 3 @question_number = 3
end end
ANSWER_OPTIONS = { 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" }, "1" => { "value" => "Yes - a shared ownership scheme" },
"2" => { "value" => "Yes - a discounted ownership scheme" }, "2" => { "value" => "Yes - a discounted ownership scheme" },
"3" => { "value" => "No - this is an outright or other sale" }, "3" => { "value" => "No - this is an outright or other sale" },
}.freeze }.freeze
end end
end
end

22
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_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) } 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 it "has correct page" do
expect(question.page).to eq(page) 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" }, "3" => { "value" => "No - this is an outright or other sale" },
}) })
end 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 end

Loading…
Cancel
Save