Browse Source

update options for shared ownership type for 23_24

various minor copy changes
reordering
one new option
update tests to reflect this change
pull/1323/head
Arthur Campbell 3 years ago
parent
commit
c7c6ba9e07
  1. 13
      app/models/form/sales/questions/shared_ownership_type.rb
  2. 4
      spec/models/form/sales/pages/shared_ownership_type_spec.rb
  3. 44
      spec/models/form/sales/questions/shared_ownership_type_spec.rb

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

@ -6,7 +6,7 @@ class Form::Sales::Questions::SharedOwnershipType < ::Form::Question
@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"
@type = "radio"
@answer_options = ANSWER_OPTIONS
@answer_options = form.start_date.year >= 2023 ? ANSWER_OPTIONS_23_24 : ANSWER_OPTIONS
end
ANSWER_OPTIONS = {
@ -18,4 +18,15 @@ class Form::Sales::Questions::SharedOwnershipType < ::Form::Question
"31" => { "value" => "Right to Shared Ownership" },
"30" => { "value" => "Shared Ownership - 2021 model lease" },
}.freeze
ANSWER_OPTIONS_23_24 = {
"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" },
}.freeze
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_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
expect(page.subsection).to eq(subsection)

44
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_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
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")
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"2" => { "value" => "Shared Ownership" },
"24" => { "value" => "Old Persons Shared Ownership" },
"18" => { "value" => "Social HomeBuy (shared ownership purchase)" },
"16" => { "value" => "Home Ownership for people with Long Term Disabilities (HOLD)" },
"28" => { "value" => "Rent to Buy - Shared Ownership" },
"31" => { "value" => "Right to Shared Ownership" },
"30" => { "value" => "Shared Ownership - 2021 model lease" },
})
context "when form start date is 2022" do
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"2" => { "value" => "Shared Ownership" },
"24" => { "value" => "Old Persons Shared Ownership" },
"18" => { "value" => "Social HomeBuy (shared ownership purchase)" },
"16" => { "value" => "Home Ownership for people with Long Term Disabilities (HOLD)" },
"28" => { "value" => "Rent to Buy - Shared Ownership" },
"31" => { "value" => "Right to Shared Ownership" },
"30" => { "value" => "Shared Ownership - 2021 model lease" },
})
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

Loading…
Cancel
Save