From e4c63b3602945233ab7f50a56f06fa74b3766311 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:03:53 +0000 Subject: [PATCH] Update whellchair hint text (#2226) --- app/models/form/lettings/questions/wheelchair.rb | 2 +- .../questions/property_wheelchair_accessible.rb | 1 + .../pages/property_wheelchair_accessible_spec.rb | 4 ++++ .../form/lettings/questions/wheelchair_spec.rb | 16 ++++++++++++++++ .../pages/property_wheelchair_accessible_spec.rb | 4 ++++ .../property_wheelchair_accessible_spec.rb | 16 ++++++++++++++++ 6 files changed, 42 insertions(+), 1 deletion(-) diff --git a/app/models/form/lettings/questions/wheelchair.rb b/app/models/form/lettings/questions/wheelchair.rb index 3ba4f081f..c2aaa3700 100644 --- a/app/models/form/lettings/questions/wheelchair.rb +++ b/app/models/form/lettings/questions/wheelchair.rb @@ -6,7 +6,7 @@ class Form::Lettings::Questions::Wheelchair < ::Form::Question @header = "Is the property built or adapted to wheelchair-user standards?" @type = "radio" @check_answers_card_number = 0 - @hint_text = "" + @hint_text = form.start_year_after_2024? ? "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." : "" @answer_options = ANSWER_OPTIONS @question_number = 21 end diff --git a/app/models/form/sales/questions/property_wheelchair_accessible.rb b/app/models/form/sales/questions/property_wheelchair_accessible.rb index feb017be0..588f350a2 100644 --- a/app/models/form/sales/questions/property_wheelchair_accessible.rb +++ b/app/models/form/sales/questions/property_wheelchair_accessible.rb @@ -7,6 +7,7 @@ class Form::Sales::Questions::PropertyWheelchairAccessible < ::Form::Question @type = "radio" @answer_options = ANSWER_OPTIONS @question_number = 17 + @hint_text = form.start_year_after_2024? ? "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." : nil end ANSWER_OPTIONS = { diff --git a/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb b/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb index b96a55feb..522a19905 100644 --- a/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb @@ -5,6 +5,10 @@ RSpec.describe Form::Lettings::Pages::PropertyWheelchairAccessible, type: :model let(:subsection) { instance_double(Form::Subsection) } + before do + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false)) + end + it "has correct subsection" do expect(page.subsection).to be(subsection) end diff --git a/spec/models/form/lettings/questions/wheelchair_spec.rb b/spec/models/form/lettings/questions/wheelchair_spec.rb index ac0241674..1fa65a68b 100644 --- a/spec/models/form/lettings/questions/wheelchair_spec.rb +++ b/spec/models/form/lettings/questions/wheelchair_spec.rb @@ -4,6 +4,12 @@ RSpec.describe Form::Lettings::Questions::Wheelchair, type: :model do subject(:question) { described_class.new(nil, nil, page) } let(:page) { instance_double(Form::Page) } + let(:subsection) { instance_double(Form::Subsection) } + + before do + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false)) + end it "has correct page" do expect(question.page).to eq(page) @@ -39,4 +45,14 @@ RSpec.describe Form::Lettings::Questions::Wheelchair, type: :model do it "is not marked as derived" do expect(question.derived?).to be false end + + context "with 2024 form" do + before do + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: true)) + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq "This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property." + end + end end diff --git a/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb b/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb index f83bb7907..a788bc687 100644 --- a/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/sales/pages/property_wheelchair_accessible_spec.rb @@ -7,6 +7,10 @@ RSpec.describe Form::Sales::Pages::PropertyWheelchairAccessible, type: :model do let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection) } + before do + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false)) + end + it "has correct subsection" do expect(page.subsection).to eq(subsection) end diff --git a/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb b/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb index c8d7eadaf..bea482aca 100644 --- a/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb @@ -6,6 +6,12 @@ RSpec.describe Form::Sales::Questions::PropertyWheelchairAccessible, type: :mode let(:question_id) { nil } let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } + let(:subsection) { instance_double(Form::Subsection) } + + before do + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: false)) + end it "has correct page" do expect(question.page).to eq(page) @@ -38,4 +44,14 @@ RSpec.describe Form::Sales::Questions::PropertyWheelchairAccessible, type: :mode "3" => { "value" => "Don't know" }, }) end + + context "with 2024 form" do + before do + allow(subsection).to receive(:form).and_return(instance_double(Form, start_year_after_2024?: true)) + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq("This is whether someone who uses a wheelchair is able to make full use of all of the property’s rooms and facilities, including use of both inside and outside space, and entering and exiting the property.") + end + end end