Browse Source

CLDC-2439: informative rendering change, content change, test updated

pull/1718/head
Aaron Spencer 3 years ago
parent
commit
27890af6b0
  1. 1
      app/helpers/interruption_screen_helper.rb
  2. 19
      app/models/form/lettings/pages/max_rent_value_check.rb
  3. 2
      app/models/form/lettings/pages/min_rent_value_check.rb
  4. 3
      config/locales/en.yml
  5. 2
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

1
app/helpers/interruption_screen_helper.rb

@ -1,5 +1,6 @@
module InterruptionScreenHelper module InterruptionScreenHelper
def display_informative_text(informative_text, log) def display_informative_text(informative_text, log)
return informative_text if informative_text.is_a? String
return "" unless informative_text["arguments"] return "" unless informative_text["arguments"]
translation_params = {} translation_params = {}

19
app/models/form/lettings/pages/max_rent_value_check.rb

@ -4,26 +4,13 @@ class Form::Lettings::Pages::MaxRentValueCheck < ::Form::Page
@depends_on = [{ "rent_in_soft_max_range?" => true }] @depends_on = [{ "rent_in_soft_max_range?" => true }]
@title_text = { @title_text = {
"translation" => "soft_validations.rent.outside_range_title", "translation" => "soft_validations.rent.outside_range_title",
"arguments" => [ "arguments" => [{
{
"key" => "brent", "key" => "brent",
"label" => true, "label" => true,
"i18n_template" => "brent", "i18n_template" => "brent",
}, }],
],
} }
# @informative_text = {} @informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "higher")
@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",
},
],
}
@check_answers_card_number = check_answers_card_number @check_answers_card_number = check_answers_card_number
end end

2
app/models/form/lettings/pages/min_rent_value_check.rb

@ -10,7 +10,7 @@ class Form::Lettings::Pages::MinRentValueCheck < ::Form::Page
"i18n_template" => "brent", "i18n_template" => "brent",
}], }],
} }
@informative_text = {} @informative_text = I18n.t("soft_validations.rent.informative_text", higher_or_lower: "lower")
@check_answers_card_number = check_answers_card_number @check_answers_card_number = check_answers_card_number
end end

3
config/locales/en.yml

@ -595,8 +595,7 @@ 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?" 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: rent:
outside_range_title: "You told us the rent is %{brent}" outside_range_title: "You told us the rent is %{brent}"
min_hint_text: "This is lower than we would expect." informative_text: "This is %{higher_or_lower} than we would expect."
max_hint_text: "This is higher than we would expect."
hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>" hint_text: "Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>"
purchase_price: purchase_price:
title_text: "You told us the purchase price is %{value}" title_text: "You told us the purchase price is %{value}"

2
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -1028,7 +1028,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "populates with correct error message" 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).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 end
end end

Loading…
Cancel
Save