Browse Source

CLDC-3110: Tweak validation messages

pull/2136/head
Rachael Booth 2 years ago
parent
commit
a11f4ee027
  1. 8
      config/locales/en.yml
  2. 4
      spec/features/form/validations_spec.rb
  3. 10
      spec/models/validations/financial_validations_spec.rb

8
config/locales/en.yml

@ -361,8 +361,8 @@ en:
benefits: benefits:
part_or_full_time: "Answer cannot be ‘all’ for income from Universal Credit, state pensions or benefits if the tenant or their partner works part-time or full-time" part_or_full_time: "Answer cannot be ‘all’ for income from Universal Credit, state pensions or benefits if the tenant or their partner works part-time or full-time"
earnings: earnings:
over_hard_max: "Net income cannot be greater than %{hard_max} per week given the household’s working situation" over_hard_max: "The household's income cannot be greater than %{hard_max} per week given the household’s working situation"
under_hard_min: "Net income cannot be less than %{hard_min} per week given the household’s working situation" under_hard_min: "The household's income cannot be less than %{hard_min} per week given the household’s working situation"
freq_missing: "Select how often the household receives income" freq_missing: "Select how often the household receives income"
earnings_missing: "Enter how much income the household has in total" earnings_missing: "Enter how much income the household has in total"
income: income:
@ -376,7 +376,7 @@ en:
less_than_shortfall: "Enter an amount that is more than the shortfall in basic rent" less_than_shortfall: "Enter an amount that is more than the shortfall in basic rent"
out_of_range: "Enter a value for the %{charge_name} between £0 and %{maximum_per_period} paid %{frequency}. %{maximum_per_period} is the max limit for rent and charges paid %{frequency} for %{letting_type} lettings owned by a %{provider_type}." out_of_range: "Enter a value for the %{charge_name} between £0 and %{maximum_per_period} paid %{frequency}. %{maximum_per_period} is the max limit for rent and charges paid %{frequency} for %{letting_type} lettings owned by a %{provider_type}."
ecstat: ecstat:
over_hard_max: "Net household income of %{earnings} %{frequency} is too high given the household’s working situation" over_hard_max: "The household's income of %{earnings} %{frequency} is too high given the household’s working situation"
brent: brent:
below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms" below_hard_min: "Rent is below the absolute minimum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms"
above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms" above_hard_max: "Rent is higher than the absolute maximum expected for a property of this type. Please check the rent, rent period, local authority and (if general needs) number of bedrooms"
@ -610,7 +610,7 @@ en:
soft_validations: soft_validations:
net_income: net_income:
title_text: "You told us that household income is %{earnings} %{incfreq}." title_text: "You told us that the household's income is %{earnings} %{incfreq}."
hint_text: "This is %{net_income_higher_or_lower_text} than we would expect for their working situation." hint_text: "This is %{net_income_higher_or_lower_text} than we would expect for their working situation."
in_soft_min_range: in_soft_min_range:
message: "Net income is lower than expected based on the household's working situation. Are you sure this is correct?" message: "Net income is lower than expected based on the household's working situation. Are you sure this is correct?"

4
spec/features/form/validations_spec.rb

@ -147,7 +147,7 @@ RSpec.describe "validations" do
it "prompts the user to confirm the value is correct with an interruption screen" do it "prompts the user to confirm the value is correct with an interruption screen" do
expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-value-check") expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-value-check")
expect(page).to have_content("You told us that household income is £750.00 weekly.") expect(page).to have_content("You told us that the household's income is £750.00 weekly.")
expect(page).to have_content("This is higher than we would expect for their working situation.") expect(page).to have_content("This is higher than we would expect for their working situation.")
expect(page).not_to have_button("Save changes") expect(page).not_to have_button("Save changes")
click_button("Confirm and continue") click_button("Confirm and continue")
@ -165,7 +165,7 @@ RSpec.describe "validations" do
choose("lettings-log-incfreq-1-field", allow_label_click: true) choose("lettings-log-incfreq-1-field", allow_label_click: true)
click_button("Save and continue") click_button("Save and continue")
expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-value-check") expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/net-income-value-check")
expect(page).not_to have_content("You told us that household income is £750.00 weekly.") expect(page).not_to have_content("You told us that the household's income is £750.00 weekly.")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success") expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
end end

10
spec/models/validations/financial_validations_spec.rb

@ -202,9 +202,9 @@ RSpec.describe Validations::FinancialValidations do
record.ecstat1 = 1 record.ecstat1 = 1
financial_validator.validate_net_income(record) financial_validator.validate_net_income(record)
expect(record.errors["earnings"]) expect(record.errors["earnings"])
.to eq(["Net income cannot be greater than £1,230.00 per week given the household’s working situation"]) .to eq(["The household's income cannot be greater than £1,230.00 per week given the household’s working situation"])
expect(record.errors["ecstat1"]) expect(record.errors["ecstat1"])
.to eq(["Net household income of £5,000.00 weekly is too high given the household’s working situation"]) .to eq(["The household's income of £5,000.00 weekly is too high given the household’s working situation"])
end end
end end
@ -215,7 +215,7 @@ RSpec.describe Validations::FinancialValidations do
record.ecstat1 = 1 record.ecstat1 = 1
financial_validator.validate_net_income(record) financial_validator.validate_net_income(record)
expect(record.errors["earnings"]) expect(record.errors["earnings"])
.to eq(["Net income cannot be less than £90.00 per week given the household’s working situation"]) .to eq(["The income's cannot be less than £90.00 per week given the household’s working situation"])
end end
end end
@ -241,7 +241,7 @@ RSpec.describe Validations::FinancialValidations do
record.ecstat3 = 9 record.ecstat3 = 9
financial_validator.validate_net_income(record) financial_validator.validate_net_income(record)
expect(record.errors["earnings"]) expect(record.errors["earnings"])
.to eq(["Net income cannot be less than £150.00 per week given the household’s working situation"]) .to eq(["The household's income cannot be less than £150.00 per week given the household’s working situation"])
end end
it "adds errors to all tenant ecstat fields when income is too high" do it "adds errors to all tenant ecstat fields when income is too high" do
@ -254,7 +254,7 @@ RSpec.describe Validations::FinancialValidations do
financial_validator.validate_net_income(record) financial_validator.validate_net_income(record)
(1..8).each do |n| (1..8).each do |n|
expect(record.errors["ecstat#{n}"]) expect(record.errors["ecstat#{n}"])
.to eq(["Net household income of £5,000.00 weekly is too high given the household’s working situation"]) .to eq(["The household's income of £5,000.00 weekly is too high given the household’s working situation"])
end end
end end
end end

Loading…
Cancel
Save