Browse Source

CLDC-2231: Remove hint text for number of joint buyers question for 2024 forms (#2261)

pull/2265/head^2
Robert Sullivan 10 months ago committed by GitHub
parent
commit
1d6afd6657
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      app/models/form/sales/questions/number_joint_buyers.rb
  2. 16
      spec/models/form/sales/questions/number_joint_buyers_spec.rb

9
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

16
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

Loading…
Cancel
Save