Browse Source

CLDC-3832: Move and update sheltered accomodation question (#2887)

* CLDC-3832: Move and update sheltered accomodation question

* Remove 2023 options
CLDC-3844-add-rent-type-response^2
Rachael Booth 3 days ago committed by GitHub
parent
commit
8f3b104148
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      app/models/form/lettings/questions/sheltered.rb
  2. 1
      app/models/form/lettings/subsections/property_information.rb
  3. 2
      app/models/form/lettings/subsections/tenancy_information.rb
  4. 6
      config/locales/forms/2025/lettings/property_information.en.yml
  5. 6
      config/locales/forms/2025/lettings/tenancy_information.en.yml
  6. 18
      spec/models/form/lettings/questions/sheltered_spec.rb
  7. 47
      spec/models/form/lettings/subsections/property_information_spec.rb
  8. 24
      spec/models/form/lettings/subsections/tenancy_information_spec.rb

12
app/models/form/lettings/questions/sheltered.rb

@ -8,18 +8,18 @@ class Form::Lettings::Questions::Sheltered < ::Form::Question
end end
def answer_options def answer_options
if form.start_year_2024_or_later? if form.start_year_2025_or_later?
{ "1" => { "value" => "Yes – specialist retirement housing" }, { "1" => { "value" => "Yes – sheltered housing for tenants with low support needs" },
"2" => { "value" => "Yes – extra care housing" }, "2" => { "value" => "Yes – extra care housing" },
"5" => { "value" => "Yes – sheltered housing for adults aged under 55 years" }, "7" => { "value" => "Yes - other" },
"6" => { "value" => "Yes – sheltered housing for adults aged 55 years and over who are not retired" },
"3" => { "value" => "No" }, "3" => { "value" => "No" },
"divider" => { "value" => true }, "divider" => { "value" => true },
"4" => { "value" => "Don’t know" } } "4" => { "value" => "Don’t know" } }
else else
{ "2" => { "value" => "Yes – extra care housing" }, { "1" => { "value" => "Yes – specialist retirement housing" },
"1" => { "value" => "Yes – specialist retirement housing" }, "2" => { "value" => "Yes – extra care housing" },
"5" => { "value" => "Yes – sheltered housing for adults aged under 55 years" }, "5" => { "value" => "Yes – sheltered housing for adults aged under 55 years" },
"6" => { "value" => "Yes – sheltered housing for adults aged 55 years and over who are not retired" },
"3" => { "value" => "No" }, "3" => { "value" => "No" },
"divider" => { "value" => true }, "divider" => { "value" => true },
"4" => { "value" => "Don’t know" } } "4" => { "value" => "Don’t know" } }

1
app/models/form/lettings/subsections/property_information.rb

@ -25,6 +25,7 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
Form::Lettings::Pages::VoidDateValueCheck.new(nil, nil, self), Form::Lettings::Pages::VoidDateValueCheck.new(nil, nil, self),
Form::Lettings::Pages::PropertyMajorRepairs.new(nil, nil, self), Form::Lettings::Pages::PropertyMajorRepairs.new(nil, nil, self),
Form::Lettings::Pages::PropertyMajorRepairsValueCheck.new(nil, nil, self), Form::Lettings::Pages::PropertyMajorRepairsValueCheck.new(nil, nil, self),
(Form::Lettings::Pages::ShelteredAccommodation.new(nil, nil, self) if form.start_year_2025_or_later?),
].flatten.compact ].flatten.compact
end end

2
app/models/form/lettings/subsections/tenancy_information.rb

@ -16,7 +16,7 @@ class Form::Lettings::Subsections::TenancyInformation < ::Form::Subsection
Form::Lettings::Pages::TenancyLengthAffordableRent.new(nil, nil, self), Form::Lettings::Pages::TenancyLengthAffordableRent.new(nil, nil, self),
Form::Lettings::Pages::TenancyLengthIntermediateRent.new(nil, nil, self), Form::Lettings::Pages::TenancyLengthIntermediateRent.new(nil, nil, self),
(Form::Lettings::Pages::TenancyLengthPeriodic.new(nil, nil, self) if form.start_year_2024_or_later?), (Form::Lettings::Pages::TenancyLengthPeriodic.new(nil, nil, self) if form.start_year_2024_or_later?),
Form::Lettings::Pages::ShelteredAccommodation.new(nil, nil, self), (Form::Lettings::Pages::ShelteredAccommodation.new(nil, nil, self) unless form.start_year_2025_or_later?),
].flatten.compact ].flatten.compact
end end
end end

6
config/locales/forms/2025/lettings/property_information.en.yml

@ -125,3 +125,9 @@ en:
check_answer_label: "Completion date of repairs" check_answer_label: "Completion date of repairs"
hint_text: "" hint_text: ""
question_text: "When were the repairs completed?" question_text: "When were the repairs completed?"
sheltered:
page_header: ""
check_answer_label: "Is this letting in sheltered accommodation?"
hint_text: "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.</br></br>Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
question_text: "Is this letting in sheltered accommodation?"

6
config/locales/forms/2025/lettings/tenancy_information.en.yml

@ -58,9 +58,3 @@ en:
check_answer_label: "Length of periodic tenancy" check_answer_label: "Length of periodic tenancy"
hint_text: "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue" hint_text: "As this is a periodic tenancy, this question is optional. If you do not have the information available click save and continue"
question_text: "What is the length of the periodic tenancy to the nearest year?" question_text: "What is the length of the periodic tenancy to the nearest year?"
sheltered:
page_header: ""
check_answer_label: "Is this letting in sheltered accommodation?"
hint_text: "Sheltered housing and special retirement housing are for tenants with low-level care and support needs. This typically provides some limited support to enable independent living, such as alarm-based assistance or a scheme manager.</br></br>Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission."
question_text: "Is this letting in sheltered accommodation?"

18
spec/models/form/lettings/questions/sheltered_spec.rb

@ -25,12 +25,18 @@ RSpec.describe Form::Lettings::Questions::Sheltered, type: :model do
expect(question.type).to eq "radio" expect(question.type).to eq "radio"
end end
context "with 2023/24 form" do context "with 2024/25 form" do
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end
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" => "Yes – extra care housing" },
"1" => { "value" => "Yes – specialist retirement housing" }, "1" => { "value" => "Yes – specialist retirement housing" },
"2" => { "value" => "Yes – extra care housing" },
"5" => { "value" => "Yes – sheltered housing for adults aged under 55 years" }, "5" => { "value" => "Yes – sheltered housing for adults aged under 55 years" },
"6" => { "value" => "Yes – sheltered housing for adults aged 55 years and over who are not retired" },
"3" => { "value" => "No" }, "3" => { "value" => "No" },
"divider" => { "value" => true }, "divider" => { "value" => true },
"4" => { "value" => "Don’t know" }, "4" => { "value" => "Don’t know" },
@ -38,17 +44,17 @@ RSpec.describe Form::Lettings::Questions::Sheltered, type: :model do
end end
end end
context "with 2024/25 form" do context "with 2025/26 form" do
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(true)
end end
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({
"1" => { "value" => "Yes – specialist retirement housing" }, "1" => { "value" => "Yes – sheltered housing for tenants with low support needs" },
"2" => { "value" => "Yes – extra care housing" }, "2" => { "value" => "Yes – extra care housing" },
"5" => { "value" => "Yes – sheltered housing for adults aged under 55 years" }, "7" => { "value" => "Yes - other" },
"6" => { "value" => "Yes – sheltered housing for adults aged 55 years and over who are not retired" },
"3" => { "value" => "No" }, "3" => { "value" => "No" },
"divider" => { "value" => true }, "divider" => { "value" => true },
"4" => { "value" => "Don’t know" }, "4" => { "value" => "Don’t know" },

47
spec/models/form/lettings/subsections/property_information_spec.rb

@ -14,12 +14,18 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
let(:form) { instance_double(Form, start_date:) } let(:form) { instance_double(Form, start_date:) }
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end end
context "when 2023" do context "when 2023" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.utc(2023, 2, 8) }
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(false)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end
it "has correct pages" do it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq( expect(property_information.pages.map(&:id)).to eq(
%w[ %w[
@ -52,6 +58,44 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end
it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq(
%w[
uprn
uprn_confirmation
address_matcher
no_address_found
uprn_selection
address
property_local_authority
local_authority_rent_value_check
first_time_property_let_as_social_housing
property_let_type
property_vacancy_reason_not_first_let
property_vacancy_reason_first_let
property_unit_type
property_building_type
property_wheelchair_accessible
property_number_of_bedrooms
beds_rent_value_check
void_date
void_date_value_check
property_major_repairs
property_major_repairs_value_check
],
)
end
end
context "when 2025" do
let(:start_date) { Time.utc(2025, 2, 8) }
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(true)
end end
it "has correct pages" do it "has correct pages" do
@ -78,6 +122,7 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
void_date_value_check void_date_value_check
property_major_repairs property_major_repairs
property_major_repairs_value_check property_major_repairs_value_check
sheltered_accommodation
], ],
) )
end end

24
spec/models/form/lettings/subsections/tenancy_information_spec.rb

@ -16,12 +16,18 @@ RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do
let(:form) { instance_double(Form, start_date:) } let(:form) { instance_double(Form, start_date:) }
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(false) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end end
context "when 2023" do context "when 2023" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.utc(2023, 2, 8) }
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(false)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end
it "has correct pages" do it "has correct pages" do
expect(tenancy_information.pages.map(&:id)).to eq( expect(tenancy_information.pages.map(&:id)).to eq(
%w[joint starter_tenancy tenancy_type starter_tenancy_type tenancy_length tenancy_length_affordable_rent tenancy_length_intermediate_rent sheltered_accommodation], %w[joint starter_tenancy tenancy_type starter_tenancy_type tenancy_length tenancy_length_affordable_rent tenancy_length_intermediate_rent sheltered_accommodation],
@ -34,6 +40,7 @@ RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do
before do before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
end end
it "has correct pages" do it "has correct pages" do
@ -42,6 +49,21 @@ RSpec.describe Form::Lettings::Subsections::TenancyInformation, type: :model do
) )
end end
end end
context "when 2025" do
let(:start_date) { Time.utc(2025, 2, 8) }
before do
allow(form).to receive(:start_year_2024_or_later?).and_return(true)
allow(form).to receive(:start_year_2025_or_later?).and_return(true)
end
it "has correct pages" do
expect(tenancy_information.pages.map(&:id)).to eq(
%w[joint starter_tenancy tenancy_type starter_tenancy_type tenancy_length tenancy_length_affordable_rent tenancy_length_intermediate_rent tenancy_length_periodic],
)
end
end
end end
it "has the correct id" do it "has the correct id" do

Loading…
Cancel
Save