diff --git a/app/models/form/lettings/questions/previous_let_type.rb b/app/models/form/lettings/questions/previous_let_type.rb index 6c9947743..6ce55da42 100644 --- a/app/models/form/lettings/questions/previous_let_type.rb +++ b/app/models/form/lettings/questions/previous_let_type.rb @@ -6,8 +6,8 @@ class Form::Lettings::Questions::PreviousLetType < ::Form::Question @header = "What type was the property most recently let as?" @type = "radio" @check_answers_card_number = 0 - @hint_text = "" - @answer_options = ANSWER_OPTIONS + @hint_text = form.start_year_after_2024? ? "This is the rent type of the previous tenancy in this property." : "" + @answer_options = form.start_year_after_2024? ? ANSWER_OPTIONS_AFTER_2024 : ANSWER_OPTIONS @question_number = 16 end @@ -21,4 +21,15 @@ class Form::Lettings::Questions::PreviousLetType < ::Form::Question "divider" => { "value" => true }, "3" => { "value" => "Don’t know" }, }.freeze + + ANSWER_OPTIONS_AFTER_2024 = { + "1" => { "value" => "Social rent basis" }, + "2" => { "value" => "Affordable rent basis" }, + "5" => { "value" => "London Affordable Rent basis" }, + "6" => { "value" => "Rent to Buy basis" }, + "7" => { "value" => "London Living Rent basis" }, + "8" => { "value" => "Another Intermediate Rent basis" }, + "divider" => { "value" => true }, + "3" => { "value" => "Don’t know" }, + }.freeze end diff --git a/spec/models/form/lettings/questions/previous_let_type_spec.rb b/spec/models/form/lettings/questions/previous_let_type_spec.rb index b18bbc88a..9f43f0aff 100644 --- a/spec/models/form/lettings/questions/previous_let_type_spec.rb +++ b/spec/models/form/lettings/questions/previous_let_type_spec.rb @@ -4,6 +4,14 @@ RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do subject(:question) { described_class.new(nil, nil, page) } let(:page) { instance_double(Form::Page) } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form) } + + before do + allow(form).to receive(:start_year_after_2024?).and_return(false) + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + end it "has correct page" do expect(question.page).to eq page @@ -45,4 +53,27 @@ RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do "3" => { "value" => "Don’t know" }, }) end + + context "with collection year on or after 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({ + "1" => { "value" => "Social rent basis" }, + "2" => { "value" => "Affordable rent basis" }, + "5" => { "value" => "London Affordable Rent basis" }, + "6" => { "value" => "Rent to Buy basis" }, + "7" => { "value" => "London Living Rent basis" }, + "8" => { "value" => "Another Intermediate Rent basis" }, + "divider" => { "value" => true }, + "3" => { "value" => "Don’t know" }, + }) + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq("This is the rent type of the previous tenancy in this property.") + end + end end