Browse Source

CLDC-3138: Update hint text for starter tenancy question for 2024 (#2166)

* CLDC-3138: Update hint text for starter tenancy question for 2024

* Remove blank line
CLDC-3152-update-ppostcode-hint-for-23-24
Rachael Booth 11 months ago committed by GitHub
parent
commit
7326168e24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      app/models/form/lettings/questions/startertenancy.rb
  2. 37
      spec/models/form/lettings/questions/startertenancy_spec.rb

10
app/models/form/lettings/questions/startertenancy.rb

@ -6,10 +6,18 @@ class Form::Lettings::Questions::Startertenancy < ::Form::Question
@header = "Is this a starter tenancy?" @header = "Is this a starter tenancy?"
@type = "radio" @type = "radio"
@check_answers_card_number = 0 @check_answers_card_number = 0
@hint_text = "This is also known as an ‘introductory period’."
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@question_number = 26 @question_number = 26
end end
ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "2" => { "value" => "No" } }.freeze ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "2" => { "value" => "No" } }.freeze
def hint_text
if form.start_year_after_2024?
"If the tenancy has an ‘introductory period’ answer ‘yes’.<br><br>
You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy."
else
"This is also known as an ‘introductory period’."
end
end
end end

37
spec/models/form/lettings/questions/startertenancy_spec.rb

@ -0,0 +1,37 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::Startertenancy, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil }
let(:question_definition) { nil }
let(:page) { instance_double(Form::Page) }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form) }
before do
allow(page).to receive(:subsection).and_return(subsection)
allow(subsection).to receive(:form).and_return(form)
end
context "with collection year before 2024" do
before do
allow(form).to receive(:start_year_after_2024?).and_return(false)
end
it "has the correct hint_text" do
expect(question.hint_text).to eq("This is also known as an ‘introductory period’.")
end
end
context "with collection year >= 2024" do
before do
allow(form).to receive(:start_year_after_2024?).and_return(true)
end
it "has the correct updated hint_text" do
expect(question.hint_text).to eq("If the tenancy has an ‘introductory period’ answer ‘yes’.<br><br>
You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy.")
end
end
end
Loading…
Cancel
Save