Browse Source

CLDC-1806 update options for shared ownership type (#1323)

* update options for shared ownership type for 23_24
various minor copy changes
reordering
one new option
update tests to reflect this change

* alter way of setting question options to reduce future tech debt

* add in hyphen to match with the paper form
pull/1343/head^2
Arthur Campbell 2 years ago committed by GitHub
parent
commit
5b4df03a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      app/models/form/sales/questions/shared_ownership_type.rb
  2. 4
      spec/models/form/sales/pages/shared_ownership_type_spec.rb
  3. 26
      spec/models/form/sales/questions/shared_ownership_type_spec.rb

23
app/models/form/sales/questions/shared_ownership_type.rb

@ -6,16 +6,31 @@ class Form::Sales::Questions::SharedOwnershipType < ::Form::Question
@header = "What is the type of shared ownership sale?" @header = "What is the type of shared ownership sale?"
@hint_text = "A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion" @hint_text = "A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion"
@type = "radio" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = answer_options
end end
ANSWER_OPTIONS = { def answer_options
if form.start_date.year >= 2023
{
"2" => { "value" => "Shared Ownership (old model lease)" },
"30" => { "value" => "Shared Ownership (new model lease)" },
"18" => { "value" => "Social HomeBuy — shared ownership purchase" },
"16" => { "value" => "Home Ownership for people with Long-Term Disabilities (HOLD)" },
"24" => { "value" => "Older Persons Shared Ownership" },
"28" => { "value" => "Rent to Buy — Shared Ownership" },
"31" => { "value" => "Right to Shared Ownership (RtSO)" },
"32" => { "value" => "London Living Rent — Shared Ownership" },
}
else
{
"2" => { "value" => "Shared Ownership" }, "2" => { "value" => "Shared Ownership" },
"24" => { "value" => "Old Persons Shared Ownership" }, "24" => { "value" => "Old Persons Shared Ownership" },
"18" => { "value" => "Social HomeBuy (shared ownership purchase)" }, "18" => { "value" => "Social HomeBuy (shared ownership purchase)" },
"16" => { "value" => "Home Ownership for people with Long Term Disabilities (HOLD)" }, "16" => { "value" => "Home Ownership for people with Long-Term Disabilities (HOLD)" },
"28" => { "value" => "Rent to Buy - Shared Ownership" }, "28" => { "value" => "Rent to Buy - Shared Ownership" },
"31" => { "value" => "Right to Shared Ownership" }, "31" => { "value" => "Right to Shared Ownership" },
"30" => { "value" => "Shared Ownership - 2021 model lease" }, "30" => { "value" => "Shared Ownership - 2021 model lease" },
}.freeze }
end
end
end end

4
spec/models/form/sales/pages/shared_ownership_type_spec.rb

@ -5,7 +5,9 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipType, type: :model do
let(:page_id) { nil } let(:page_id) { nil }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:start_date) { Time.utc(2022, 4, 1) }
let(:form) { instance_double(Form, start_date:) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)

26
spec/models/form/sales/questions/shared_ownership_type_spec.rb

@ -5,7 +5,10 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, 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(:start_date) { Time.utc(2022, 4, 1) }
let(:form) { instance_double(Form, start_date:) }
let(:subsection) { instance_double(Form::Subsection, form:) }
let(:page) { instance_double(Form::Page, subsection:) }
it "has correct page" do it "has correct page" do
expect(question.page).to eq(page) expect(question.page).to eq(page)
@ -35,15 +38,34 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do
expect(question.hint_text).to eq("A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion") expect(question.hint_text).to eq("A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion")
end end
context "when form start date is 2022" do
it "has the correct answer_options" do it "has the correct answer_options" do
expect(question.answer_options).to eq({ expect(question.answer_options).to eq({
"2" => { "value" => "Shared Ownership" }, "2" => { "value" => "Shared Ownership" },
"24" => { "value" => "Old Persons Shared Ownership" }, "24" => { "value" => "Old Persons Shared Ownership" },
"18" => { "value" => "Social HomeBuy (shared ownership purchase)" }, "18" => { "value" => "Social HomeBuy (shared ownership purchase)" },
"16" => { "value" => "Home Ownership for people with Long Term Disabilities (HOLD)" }, "16" => { "value" => "Home Ownership for people with Long-Term Disabilities (HOLD)" },
"28" => { "value" => "Rent to Buy - Shared Ownership" }, "28" => { "value" => "Rent to Buy - Shared Ownership" },
"31" => { "value" => "Right to Shared Ownership" }, "31" => { "value" => "Right to Shared Ownership" },
"30" => { "value" => "Shared Ownership - 2021 model lease" }, "30" => { "value" => "Shared Ownership - 2021 model lease" },
}) })
end end
end
context "when form start date is 2023" do
let(:start_date) { Time.utc(2023, 4, 2) }
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"2" => { "value" => "Shared Ownership (old model lease)" },
"30" => { "value" => "Shared Ownership (new model lease)" },
"18" => { "value" => "Social HomeBuy — shared ownership purchase" },
"16" => { "value" => "Home Ownership for people with Long-Term Disabilities (HOLD)" },
"24" => { "value" => "Older Persons Shared Ownership" },
"28" => { "value" => "Rent to Buy — Shared Ownership" },
"31" => { "value" => "Right to Shared Ownership (RtSO)" },
"32" => { "value" => "London Living Rent — Shared Ownership" },
})
end
end
end end

Loading…
Cancel
Save