Browse Source

Update tenancy lenght hint text (#2165)

pull/2175/head
kosiakkatrina 11 months ago committed by GitHub
parent
commit
ccf275716e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      app/models/form/lettings/questions/tenancy_length_affordable_rent.rb
  2. 9
      app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb
  3. 51
      spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb
  4. 51
      spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb

9
app/models/form/lettings/questions/tenancy_length_affordable_rent.rb

@ -9,8 +9,15 @@ class Form::Lettings::Questions::TenancyLengthAffordableRent < ::Form::Question
@check_answers_card_number = 0
@max = 150
@min = 0
@hint_text = "Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs and you do not need a log for shorter tenancies."
@step = 1
@question_number = 28
end
def hint_text
if form.start_year_after_2024?
"Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years."
else
"Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs and you do not need a log for shorter tenancies."
end
end
end

9
app/models/form/lettings/questions/tenancy_length_intermediate_rent.rb

@ -9,8 +9,15 @@ class Form::Lettings::Questions::TenancyLengthIntermediateRent < ::Form::Questio
@check_answers_card_number = 0
@max = 150
@min = 0
@hint_text = "Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs and you do not need a log for shorter tenancies."
@step = 1
@question_number = 28
end
def hint_text
if form.start_year_after_2024?
"Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 1 year."
else
"Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs and you do not need a log for shorter tenancies."
end
end
end

51
spec/models/form/lettings/questions/tenancy_length_affordable_rent_spec.rb

@ -0,0 +1,51 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyLengthAffordableRent, type: :model do
subject(:question) { described_class.new(nil, nil, 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(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)
end
it "has the correct id" do
expect(question.id).to eq("tenancylength")
end
it "has the correct header" do
expect(question.header).to eq("What is the length of the fixed-term tenancy to the nearest year?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Length of fixed-term tenancy")
end
it "has the correct type" do
expect(question.type).to eq("numeric")
end
it "has the correct hint_text" do
expect(question.hint_text).to eq("Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs and you do not need a log for shorter tenancies.")
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 hint_text" do
expect(question.hint_text).to eq("Do not include the starter or introductory period.</br>The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years.")
end
end
end

51
spec/models/form/lettings/questions/tenancy_length_intermediate_rent_spec.rb

@ -0,0 +1,51 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::TenancyLengthIntermediateRent, type: :model do
subject(:question) { described_class.new(nil, nil, 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(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)
end
it "has the correct id" do
expect(question.id).to eq("tenancylength")
end
it "has the correct header" do
expect(question.header).to eq("What is the length of the fixed-term tenancy to the nearest year?")
end
it "has the correct check_answer_label" do
expect(question.check_answer_label).to eq("Length of fixed-term tenancy")
end
it "has the correct type" do
expect(question.type).to eq("numeric")
end
it "has the correct hint_text" do
expect(question.hint_text).to eq("Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs and you do not need a log for shorter tenancies.")
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 hint_text" do
expect(question.hint_text).to eq("Do not include the starter or introductory period.</br>The minimum period is 1 year for intermediate rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 1 year.")
end
end
end
Loading…
Cancel
Save