From 1d6afd6657edcd7fe691bc6b94689c158951bc3b Mon Sep 17 00:00:00 2001 From: Robert Sullivan Date: Tue, 27 Feb 2024 09:54:49 +0000 Subject: [PATCH] CLDC-2231: Remove hint text for number of joint buyers question for 2024 forms (#2261) --- .../form/sales/questions/number_joint_buyers.rb | 9 ++++++++- .../sales/questions/number_joint_buyers_spec.rb | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/models/form/sales/questions/number_joint_buyers.rb b/app/models/form/sales/questions/number_joint_buyers.rb index bd8a6ef3a..228cebab1 100644 --- a/app/models/form/sales/questions/number_joint_buyers.rb +++ b/app/models/form/sales/questions/number_joint_buyers.rb @@ -4,7 +4,6 @@ class Form::Sales::Questions::NumberJointBuyers < ::Form::Question @id = "jointmore" @check_answer_label = "More than 2 joint buyers" @header = "Are there more than 2 joint buyers of this property?" - @hint_text = "You should still try to answer all questions even if the buyer wasn't interviewed in person" @type = "radio" @answer_options = ANSWER_OPTIONS @question_number = 10 @@ -15,4 +14,12 @@ class Form::Sales::Questions::NumberJointBuyers < ::Form::Question "2" => { "value" => "No" }, "3" => { "value" => "Don’t know" }, }.freeze + + def hint_text + if form.start_year_after_2024? + nil + else + "You should still try to answer all questions even if the buyer wasn't interviewed in person" + end + end end diff --git a/spec/models/form/sales/questions/number_joint_buyers_spec.rb b/spec/models/form/sales/questions/number_joint_buyers_spec.rb index a16502f9f..bfad4a796 100644 --- a/spec/models/form/sales/questions/number_joint_buyers_spec.rb +++ b/spec/models/form/sales/questions/number_joint_buyers_spec.rb @@ -6,6 +6,12 @@ RSpec.describe Form::Sales::Questions::NumberJointBuyers, type: :model do 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) @@ -42,4 +48,14 @@ RSpec.describe Form::Sales::Questions::NumberJointBuyers, type: :model do "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 no hint_text" do + expect(question.hint_text).to be_nil + end + end end