diff --git a/app/helpers/interruption_screen_helper.rb b/app/helpers/interruption_screen_helper.rb
index fc75f6f59..b28c7eaa9 100644
--- a/app/helpers/interruption_screen_helper.rb
+++ b/app/helpers/interruption_screen_helper.rb
@@ -1,5 +1,6 @@
module InterruptionScreenHelper
def display_informative_text(informative_text, log)
+ return informative_text if informative_text.is_a? String
return "" unless informative_text["arguments"]
translation_params = {}
diff --git a/app/models/form/lettings/pages/max_rent_value_check.rb b/app/models/form/lettings/pages/max_rent_value_check.rb
index ffb90f035..82aff8481 100644
--- a/app/models/form/lettings/pages/max_rent_value_check.rb
+++ b/app/models/form/lettings/pages/max_rent_value_check.rb
@@ -4,29 +4,18 @@ class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page
@depends_on = [{ "rent_in_soft_max_range?" => true }]
@title_text = {
"translation" => "soft_validations.rent.outside_range_title",
- "arguments" => [
- {
- "key" => "brent",
- "label" => true,
- "i18n_template" => "brent",
- },
- ],
- }
- @informative_text = {
- "translation" => "soft_validations.rent.max_hint_text",
- "arguments" => [
- {
- "key" => "field_formatted_as_currency",
- "arguments_for_key" => "soft_max_for_period",
- "i18n_template" => "soft_max_for_period",
- },
- ],
+ "arguments" => [{
+ "key" => "brent",
+ "label" => true,
+ "i18n_template" => "brent",
+ }],
}
+ @informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "higher")
@check_answers_card_number = check_answers_card_number
end
def questions
- @questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
+ @questions ||= [Form::Lettings::Questions::MaxRentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
diff --git a/app/models/form/lettings/pages/min_rent_value_check.rb b/app/models/form/lettings/pages/min_rent_value_check.rb
index f66bc5a7b..b2bae4e8e 100644
--- a/app/models/form/lettings/pages/min_rent_value_check.rb
+++ b/app/models/form/lettings/pages/min_rent_value_check.rb
@@ -10,19 +10,12 @@ class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page
"i18n_template" => "brent",
}],
}
- @informative_text = {
- "translation" => "soft_validations.rent.min_hint_text",
- "arguments" => [{
- "key" => "field_formatted_as_currency",
- "arguments_for_key" => "soft_min_for_period",
- "i18n_template" => "soft_min_for_period",
- }],
- }
+ @informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "lower")
@check_answers_card_number = check_answers_card_number
end
def questions
- @questions ||= [Form::Lettings::Questions::RentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
+ @questions ||= [Form::Lettings::Questions::MinRentValueCheck.new(nil, nil, self, check_answers_card_number: @check_answers_card_number)]
end
def interruption_screen_question_ids
diff --git a/app/models/form/lettings/questions/max_rent_value_check.rb b/app/models/form/lettings/questions/max_rent_value_check.rb
new file mode 100644
index 000000000..6936e9e36
--- /dev/null
+++ b/app/models/form/lettings/questions/max_rent_value_check.rb
@@ -0,0 +1,15 @@
+class Form::Lettings::Questions::MaxRentValueCheck < ::Form::Question
+ def initialize(id, hsh, page, check_answers_card_number:)
+ super(id, hsh, page)
+ @id = "rent_value_check"
+ @check_answer_label = "Total rent confirmation"
+ @header = "Are you sure this is correct?"
+ @type = "interruption_screen"
+ @hint_text = I18n.t("soft_validations.rent.hint_text", higher_or_lower: "higher")
+ @check_answers_card_number = check_answers_card_number
+ @answer_options = ANSWER_OPTIONS
+ @hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] }
+ end
+
+ ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze
+end
diff --git a/app/models/form/lettings/questions/rent_value_check.rb b/app/models/form/lettings/questions/min_rent_value_check.rb
similarity index 77%
rename from app/models/form/lettings/questions/rent_value_check.rb
rename to app/models/form/lettings/questions/min_rent_value_check.rb
index 6bca43e30..ad4111c61 100644
--- a/app/models/form/lettings/questions/rent_value_check.rb
+++ b/app/models/form/lettings/questions/min_rent_value_check.rb
@@ -1,10 +1,11 @@
-class Form::Lettings::Questions::RentValueCheck < ::Form::Question
+class Form::Lettings::Questions::MinRentValueCheck < ::Form::Question
def initialize(id, hsh, page, check_answers_card_number:)
super(id, hsh, page)
@id = "rent_value_check"
@check_answer_label = "Total rent confirmation"
@header = "Are you sure this is correct?"
@type = "interruption_screen"
+ @hint_text = I18n.t("soft_validations.rent.hint_text", higher_or_lower: "lower")
@check_answers_card_number = check_answers_card_number
@answer_options = ANSWER_OPTIONS
@hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] }
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 49aa2d6f1..1365fda3d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -595,8 +595,8 @@ en:
over_soft_max_for_la_combined: "You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?"
rent:
outside_range_title: "You told us the rent is %{brent}"
- min_hint_text: "The minimum rent expected for this type of property in this local authority is %{soft_min_for_period}."
- max_hint_text: "The maximum rent expected for this type of property in this local authority is %{soft_max_for_period}."
+ informative_text: "This is %{higher_or_lower} than we would expect."
+ hint_text: "Check the following:
- the decimal point
- the frequency, for example every week or every calendar month
- the rent type is correct, for example affordable or social rent
"
purchase_price:
title_text: "You told us the purchase price is %{value}"
hint_text: "This is %{higher_or_lower} than we would expect"
diff --git a/spec/helpers/interruption_screen_helper_spec.rb b/spec/helpers/interruption_screen_helper_spec.rb
index 6d9122f27..a100cf3ad 100644
--- a/spec/helpers/interruption_screen_helper_spec.rb
+++ b/spec/helpers/interruption_screen_helper_spec.rb
@@ -163,6 +163,13 @@ RSpec.describe InterruptionScreenHelper do
expect(display_informative_text(informative_text_hash, lettings_log)).to eq("You said this: £12,345.00")
end
end
+
+ context "when a string given" do
+ it "returns the string" do
+ test_string = "some words"
+ expect(display_informative_text(test_string, lettings_log)).to eq(test_string)
+ end
+ end
end
describe "display_title_text" do
diff --git a/spec/models/form/lettings/pages/max_rent_value_check_spec.rb b/spec/models/form/lettings/pages/max_rent_value_check_spec.rb
index 7bcc87913..4bbe3d18f 100644
--- a/spec/models/form/lettings/pages/max_rent_value_check_spec.rb
+++ b/spec/models/form/lettings/pages/max_rent_value_check_spec.rb
@@ -31,10 +31,6 @@ RSpec.describe Form::Lettings::Pages::MaxRentValueCheck, type: :model do
expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "brent", "key" => "brent", "label" => true }], "translation" => "soft_validations.rent.outside_range_title" })
end
- it "has the correct informative_text" do
- expect(page.informative_text).to eq({ "arguments" => [{ "arguments_for_key" => "soft_max_for_period", "i18n_template" => "soft_max_for_period", "key" => "field_formatted_as_currency" }], "translation" => "soft_validations.rent.max_hint_text" })
- end
-
it "has the correct interruption_screen_question_ids" do
expect(page.interruption_screen_question_ids).to eq(%w[brent startdate uprn postcode_full la beds rent_type needstype])
end
diff --git a/spec/models/form/lettings/pages/min_rent_value_check_spec.rb b/spec/models/form/lettings/pages/min_rent_value_check_spec.rb
index bc3c6a081..613c907e9 100644
--- a/spec/models/form/lettings/pages/min_rent_value_check_spec.rb
+++ b/spec/models/form/lettings/pages/min_rent_value_check_spec.rb
@@ -40,19 +40,6 @@ RSpec.describe Form::Lettings::Pages::MinRentValueCheck, type: :model do
})
end
- it "has the correct informative_text" do
- expect(page.informative_text).to eq({
- "translation" => "soft_validations.rent.min_hint_text",
- "arguments" => [
- {
- "key" => "field_formatted_as_currency",
- "arguments_for_key" => "soft_min_for_period",
- "i18n_template" => "soft_min_for_period",
- },
- ],
- })
- end
-
it "has the correct interruption_screen_question_ids" do
expect(page.interruption_screen_question_ids).to eq(%w[brent startdate uprn postcode_full la beds rent_type needstype])
end
diff --git a/spec/models/form/lettings/questions/max_rent_value_check_spec.rb b/spec/models/form/lettings/questions/max_rent_value_check_spec.rb
new file mode 100644
index 000000000..0fea335c4
--- /dev/null
+++ b/spec/models/form/lettings/questions/max_rent_value_check_spec.rb
@@ -0,0 +1,44 @@
+require "rails_helper"
+
+RSpec.describe Form::Lettings::Questions::MaxRentValueCheck, type: :model do
+ subject(:question) { described_class.new(nil, question_definition, page, check_answers_card_number:) }
+
+ let(:question_definition) { nil }
+ let(:check_answers_card_number) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("rent_value_check")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Are you sure this is correct?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Total rent confirmation")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("interruption_screen")
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to eq("Check the following:- the decimal point
- the frequency, for example every week or every calendar month
- the rent type is correct, for example affordable or social rent
")
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "0" => { "value" => "Yes" },
+ "1" => { "value" => "No" },
+ })
+ end
+
+ it "has the correct hidden_in_check_answers" do
+ expect(question.hidden_in_check_answers).to eq({ "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] })
+ end
+end
diff --git a/spec/models/form/lettings/questions/min_rent_value_check_spec.rb b/spec/models/form/lettings/questions/min_rent_value_check_spec.rb
new file mode 100644
index 000000000..fec1e7d97
--- /dev/null
+++ b/spec/models/form/lettings/questions/min_rent_value_check_spec.rb
@@ -0,0 +1,44 @@
+require "rails_helper"
+
+RSpec.describe Form::Lettings::Questions::MinRentValueCheck, type: :model do
+ subject(:question) { described_class.new(nil, question_definition, page, check_answers_card_number:) }
+
+ let(:question_definition) { nil }
+ let(:check_answers_card_number) { nil }
+ let(:page) { instance_double(Form::Page) }
+
+ it "has correct page" do
+ expect(question.page).to eq(page)
+ end
+
+ it "has the correct id" do
+ expect(question.id).to eq("rent_value_check")
+ end
+
+ it "has the correct header" do
+ expect(question.header).to eq("Are you sure this is correct?")
+ end
+
+ it "has the correct check_answer_label" do
+ expect(question.check_answer_label).to eq("Total rent confirmation")
+ end
+
+ it "has the correct type" do
+ expect(question.type).to eq("interruption_screen")
+ end
+
+ it "has the correct hint" do
+ expect(question.hint_text).to eq("Check the following:- the decimal point
- the frequency, for example every week or every calendar month
- the rent type is correct, for example affordable or social rent
")
+ end
+
+ it "has the correct answer_options" do
+ expect(question.answer_options).to eq({
+ "0" => { "value" => "Yes" },
+ "1" => { "value" => "No" },
+ })
+ end
+
+ it "has the correct hidden_in_check_answers" do
+ expect(question.hidden_in_check_answers).to eq({ "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] })
+ end
+end
diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
index 4df2757cd..f3a17ac44 100644
--- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
+++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
@@ -1098,7 +1098,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "populates with correct error message" do
expect(parser.errors.where(:field_128, category: :soft_validation).count).to be(1)
- expect(parser.errors.where(:field_128, category: :soft_validation).first.message).to eql("You told us the rent is £120.00 every week. The maximum rent expected for this type of property in this local authority is ££118.85 every week.")
+ expect(parser.errors.where(:field_128, category: :soft_validation).first.message).to eql("You told us the rent is £120.00 every week. This is higher than we would expect.")
end
end
end