diff --git a/app/models/form/lettings/questions/rent_type.rb b/app/models/form/lettings/questions/rent_type.rb index 35e63dd35..7454cd752 100644 --- a/app/models/form/lettings/questions/rent_type.rb +++ b/app/models/form/lettings/questions/rent_type.rb @@ -5,8 +5,8 @@ class Form::Lettings::Questions::RentType < ::Form::Question @check_answer_label = "Rent type" @header = "What is the rent type?" @type = "radio" - @top_guidance_partial = "rent_type_definitions" - @answer_options = ANSWER_OPTIONS + @top_guidance_partial = form.start_year_after_2024? ? "rent_type_definitions_2024" : "rent_type_definitions" + @answer_options = form.start_year_after_2024? ? ANSWER_OPTIONS_2024 : ANSWER_OPTIONS @conditional_for = { "irproduct_other" => [5] } @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? end @@ -20,5 +20,14 @@ class Form::Lettings::Questions::RentType < ::Form::Question "5" => { "value" => "Other intermediate rent product" }, }.freeze + ANSWER_OPTIONS_2024 = { + "0" => { "value" => "Social Rent" }, + "1" => { "value" => "Affordable Rent" }, + "2" => { "value" => "London Affordable Rent" }, + "3" => { "value" => "Rent to Buy" }, + "4" => { "value" => "London Living Rent" }, + "5" => { "value" => "Other intermediate rent product" }, + }.freeze + QUESTION_NUMBER_FROM_YEAR = { 2023 => 6, 2024 => 8 }.freeze end diff --git a/app/views/form/guidance/_rent_type_definitions_2024.erb b/app/views/form/guidance/_rent_type_definitions_2024.erb new file mode 100644 index 000000000..ee835b4a0 --- /dev/null +++ b/app/views/form/guidance/_rent_type_definitions_2024.erb @@ -0,0 +1,21 @@ +<%= govuk_details(summary_text: "Rent type definitions") do %> +

+ Social Rent: where target rents are determined through the national rent regime. This is sometimes also known as 'formula rent'. +

+

+ Affordable Rent: where up to 80% of market rent can be charged. A new supply agreement is signed with Homes England or the Greater London Authority (GLA). +

+

+ London Affordable Rent: a tenure of affordable housing available in London by the GLA. It is an affordable rent which must be set in accordance with the Regulator of Social Housing’s Affordable Rent guidance. The landlord of these homes must be registered with the Regulator of Social Housing. These are a type of Affordable Rent lettings. +

+

+ Rent to Buy: a discount of up to 20% market rent is charged for a single rental period for a minimum of 5 years. After that period, the tenant is offered first chance to purchase the property (either shared ownership or outright) at full market value. These are a type of Intermediate Rent lettings. +

+

+ London Living Rent: a tenure of affordable housing available in London by the GLA. It was introduced in Affordable Homes Programme 2016 to 2021. These are a type of Intermediate Rent lettings. +

+ +

+ Other intermediate rent: any other specific scheme where up to 80% of market rent can be charged. This includes schemes with reduced rent so tenants can save towards a house purchasing deposit and schemes with an in-built future opportunity to buy the property being rented. +

+<% end %> diff --git a/spec/models/form/lettings/pages/rent_type_spec.rb b/spec/models/form/lettings/pages/rent_type_spec.rb index be4da3775..0b3b6bf90 100644 --- a/spec/models/form/lettings/pages/rent_type_spec.rb +++ b/spec/models/form/lettings/pages/rent_type_spec.rb @@ -5,7 +5,13 @@ RSpec.describe Form::Lettings::Pages::RentType, type: :model do 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) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } + + before do + allow(subsection).to receive(:form).and_return(form) + allow(form).to receive(:start_year_after_2024?).and_return(true) + end it "has correct subsection" do expect(page.subsection).to eq(subsection) diff --git a/spec/models/form/lettings/questions/rent_type_spec.rb b/spec/models/form/lettings/questions/rent_type_spec.rb index bc66348f5..62d8145d1 100644 --- a/spec/models/form/lettings/questions/rent_type_spec.rb +++ b/spec/models/form/lettings/questions/rent_type_spec.rb @@ -5,7 +5,15 @@ RSpec.describe Form::Lettings::Questions::RentType, 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(:page) { instance_double(Form::Page) } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) } + + before do + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + allow(form).to receive(:start_year_after_2024?).and_return(false) + end it "has correct page" do expect(question.page).to eq(page) @@ -35,22 +43,49 @@ RSpec.describe Form::Lettings::Questions::RentType, type: :model do expect(question.conditional_for).to eq({ "irproduct_other" => [5] }) end - it "has the correct answer_options" do - expect(question.answer_options).to eq({ - "1" => { "value" => "Affordable Rent" }, - "2" => { "value" => "London Affordable Rent" }, - "4" => { "value" => "London Living Rent" }, - "3" => { "value" => "Rent to Buy" }, - "0" => { "value" => "Social Rent" }, - "5" => { "value" => "Other intermediate rent product" }, - }) - end - it "is not marked as derived" do expect(question.derived?).to be false end - it "has the guidance partial" do - expect(question.top_guidance_partial).to eq("rent_type_definitions") + context "when 2023" do + before do + allow(form).to receive(:start_year_after_2024?).and_return(false) + end + + it "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Affordable Rent" }, + "2" => { "value" => "London Affordable Rent" }, + "4" => { "value" => "London Living Rent" }, + "3" => { "value" => "Rent to Buy" }, + "0" => { "value" => "Social Rent" }, + "5" => { "value" => "Other intermediate rent product" }, + }) + end + + it "has the correct guidance partial" do + expect(question.top_guidance_partial).to eq("rent_type_definitions") + end + end + + context "when 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({ + "0" => { "value" => "Social Rent" }, + "1" => { "value" => "Affordable Rent" }, + "2" => { "value" => "London Affordable Rent" }, + "3" => { "value" => "Rent to Buy" }, + "4" => { "value" => "London Living Rent" }, + "5" => { "value" => "Other intermediate rent product" }, + }) + end + + it "has the correct guidance partial" do + expect(question.top_guidance_partial).to eq("rent_type_definitions_2024") + end end end