Browse Source

Merge branch 'main' into CLDC-4140-remove-old-gender-question-lettings

CLDC-4140-remove-old-gender-question-lettings
Nat Dean-Lewis 5 days ago
parent
commit
674bcfde47
  1. 1
      app/models/form/lettings/questions/needs_type.rb
  2. 5
      app/views/form/guidance/_needs_type.html.erb
  3. 4
      config/locales/forms/2026/lettings/guidance.en.yml
  4. 4
      config/locales/forms/2026/lettings/setup.en.yml
  5. 4
      spec/models/form/lettings/pages/needs_type_spec.rb
  6. 17
      spec/models/form/lettings/questions/needs_type_spec.rb

1
app/models/form/lettings/questions/needs_type.rb

@ -5,6 +5,7 @@ class Form::Lettings::Questions::NeedsType < ::Form::Question
@type = "radio"
@answer_options = ANSWER_OPTIONS
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present?
@top_guidance_partial = "needs_type" if form.start_year_2026_or_later?
end
ANSWER_OPTIONS = {

5
app/views/form/guidance/_needs_type.html.erb

@ -0,0 +1,5 @@
<div class="govuk-body">
<%= govuk_details(summary_text: I18n.t("forms.#{@log.form.start_date.year}.lettings.guidance.needs_type.title")) do %>
<%= I18n.t("forms.#{@log.form.start_date.year}.lettings.guidance.needs_type.content").html_safe %>
<% end %>
</div>

4
config/locales/forms/2026/lettings/guidance.en.yml

@ -67,3 +67,7 @@ en:
<li>Some properties may not be available yet e.g. new builds; you might need to enter them manually instead</li>
<li>For UPRN (Unique Property Reference Number), please enter the full value exactly</li>
</ul>"
needs_type:
title: "What does each need type mean?"
content: "General needs housing includes both self-contained and shared housing without support or specific adaptations.<br><br>Supported housing is housing with special design facilities or features targeted at a specific client group requiring support, for example housing designed for older people, sheltered accommodation, extra care housing. It can include direct access hostels, group homes, and purpose-built self-contained housing. We do not require CORE logs for residential care or nursing homes."

4
config/locales/forms/2026/lettings/setup.en.yml

@ -25,10 +25,10 @@ en:
question_text: "Which user are you creating this log for?"
needstype:
page_header: ""
page_header: "Needs type"
check_answer_label: "Needs type"
check_answer_prompt: ""
hint_text: "General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing can include direct access hostels, group homes, residential care and nursing homes."
hint_text: ""
question_text: "What is the needs type?"
scheme_id:

4
spec/models/form/lettings/pages/needs_type_spec.rb

@ -1,11 +1,13 @@
require "rails_helper"
RSpec.describe Form::Lettings::Pages::NeedsType, type: :model do
include CollectionTimeHelper
subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil }
let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1))) }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: current_collection_start_date, start_year_2026_or_later?: true)) }
it "has correct subsection" do
expect(page.subsection).to eq(subsection)

17
spec/models/form/lettings/questions/needs_type_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Lettings::Questions::NeedsType, type: :model do
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
let(:start_year_2026_or_later?) { false }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1), start_year_2026_or_later?: start_year_2026_or_later?))) }
it "has correct page" do
expect(question.page).to eq(page)
@ -29,4 +30,18 @@ RSpec.describe Form::Lettings::Questions::NeedsType, type: :model do
"2" => { "value" => "Supported housing" },
})
end
context "when 2025 logs", metadata: { year: 25 } do
it "has no top guidance partial" do
expect(question.top_guidance_partial).to be_nil
end
end
context "when 2026 logs", metadata: { year: 26 } do
let(:start_year_2026_or_later?) { true }
it "has correct guidance partial" do
expect(question.top_guidance_partial).to eq("needs_type")
end
end
end

Loading…
Cancel
Save