Compare commits

...

2 Commits

Author SHA1 Message Date
Samuel Young 75a54a78b1 CLDC-4090: Update tests 2 weeks ago
Samuel Young de8dfb9e76 CLDC-4090: Remove errors on uprn_confirmation question 2 weeks ago
  1. 2
      app/models/validations/property_validations.rb
  2. 2
      app/models/validations/sales/property_validations.rb
  3. 3
      config/locales/validations/lettings/property_information.en.yml
  4. 3
      config/locales/validations/sales/property_information.en.yml
  5. 9
      spec/models/validations/property_validations_spec.rb
  6. 6
      spec/models/validations/sales/property_validations_spec.rb

2
app/models/validations/property_validations.rb

@ -63,7 +63,6 @@ module Validations::PropertyValidations
record.errors.add :la, I18n.t("validations.lettings.property.la.not_in_england") record.errors.add :la, I18n.t("validations.lettings.property.la.not_in_england")
record.errors.add :postcode_full, I18n.t("validations.lettings.property.postcode_full.not_in_england") record.errors.add :postcode_full, I18n.t("validations.lettings.property.postcode_full.not_in_england")
record.errors.add :uprn, I18n.t("validations.lettings.property.uprn.not_in_england") record.errors.add :uprn, I18n.t("validations.lettings.property.uprn.not_in_england")
record.errors.add :uprn_confirmation, I18n.t("validations.lettings.property.uprn_confirmation.not_in_england")
record.errors.add :uprn_selection, I18n.t("validations.lettings.property.uprn_selection.not_in_england") record.errors.add :uprn_selection, I18n.t("validations.lettings.property.uprn_selection.not_in_england")
if record.uprn.present? if record.uprn.present?
record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.address_not_in_england") record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.address_not_in_england")
@ -97,7 +96,6 @@ module Validations::PropertyValidations
record.errors.add :la, I18n.t("validations.lettings.property.la.la_not_valid_for_date", la: la.name) record.errors.add :la, I18n.t("validations.lettings.property.la.la_not_valid_for_date", la: la.name)
record.errors.add :postcode_full, I18n.t("validations.lettings.property.postcode_full.la_not_valid_for_date", la: la.name) record.errors.add :postcode_full, I18n.t("validations.lettings.property.postcode_full.la_not_valid_for_date", la: la.name)
record.errors.add :uprn, I18n.t("validations.lettings.property.uprn.la_not_valid_for_date", la: la.name) record.errors.add :uprn, I18n.t("validations.lettings.property.uprn.la_not_valid_for_date", la: la.name)
record.errors.add :uprn_confirmation, I18n.t("validations.lettings.property.uprn_confirmation.la_not_valid_for_date", la: la.name)
record.errors.add :uprn_selection, I18n.t("validations.lettings.property.uprn_selection.la_not_valid_for_date", la: la.name) record.errors.add :uprn_selection, I18n.t("validations.lettings.property.uprn_selection.la_not_valid_for_date", la: la.name)
record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.la_not_valid_for_date", la: la.name) record.errors.add :startdate, I18n.t("validations.lettings.property.startdate.la_not_valid_for_date", la: la.name)
elsif record.is_supported_housing? elsif record.is_supported_housing?

2
app/models/validations/sales/property_validations.rb

@ -49,7 +49,6 @@ module Validations::Sales::PropertyValidations
record.errors.add :la, I18n.t("validations.sales.property_information.la.not_in_england") record.errors.add :la, I18n.t("validations.sales.property_information.la.not_in_england")
record.errors.add :postcode_full, I18n.t("validations.sales.property_information.postcode_full.not_in_england") record.errors.add :postcode_full, I18n.t("validations.sales.property_information.postcode_full.not_in_england")
record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.not_in_england") record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.not_in_england")
record.errors.add :uprn_confirmation, I18n.t("validations.sales.property_information.uprn_confirmation.not_in_england")
record.errors.add :uprn_selection, I18n.t("validations.sales.property_information.uprn_selection.not_in_england") record.errors.add :uprn_selection, I18n.t("validations.sales.property_information.uprn_selection.not_in_england")
if record.uprn.present? if record.uprn.present?
record.errors.add :saledate, :skip_bu_error, message: I18n.t("validations.sales.property_information.saledate.address_not_in_england") record.errors.add :saledate, :skip_bu_error, message: I18n.t("validations.sales.property_information.saledate.address_not_in_england")
@ -72,7 +71,6 @@ module Validations::Sales::PropertyValidations
record.errors.add :la, I18n.t("validations.sales.property_information.la.la_not_valid_for_date", la: la.name) record.errors.add :la, I18n.t("validations.sales.property_information.la.la_not_valid_for_date", la: la.name)
record.errors.add :postcode_full, I18n.t("validations.sales.property_information.postcode_full.la_not_valid_for_date", la: la.name) record.errors.add :postcode_full, I18n.t("validations.sales.property_information.postcode_full.la_not_valid_for_date", la: la.name)
record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.la_not_valid_for_date", la: la.name) record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.la_not_valid_for_date", la: la.name)
record.errors.add :uprn_confirmation, I18n.t("validations.sales.property_information.uprn_confirmation.la_not_valid_for_date", la: la.name)
record.errors.add :uprn_selection, I18n.t("validations.sales.property_information.uprn_selection.la_not_valid_for_date", la: la.name) record.errors.add :uprn_selection, I18n.t("validations.sales.property_information.uprn_selection.la_not_valid_for_date", la: la.name)
record.errors.add :saledate, :skip_bu_error, message: I18n.t("validations.sales.property_information.saledate.la_not_valid_for_date", la: la.name) record.errors.add :saledate, :skip_bu_error, message: I18n.t("validations.sales.property_information.saledate.la_not_valid_for_date", la: la.name)
end end

3
config/locales/validations/lettings/property_information.en.yml

@ -24,9 +24,8 @@ en:
invalid: "UPRN must be 12 digits or less." invalid: "UPRN must be 12 digits or less."
not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England." not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England."
la_not_valid_for_date: "%{la} does not exist on the tenancy start date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the tenancy start date" la_not_valid_for_date: "%{la} does not exist on the tenancy start date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the tenancy start date"
uprn_confirmation: uprn_confirmation: # legacy question
not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England." not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England."
la_not_valid_for_date: "%{la} does not exist on the tenancy start date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the tenancy start date"
uprn_selection: uprn_selection:
not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England." not_in_england: "It looks like you have entered an address outside of England. Only create logs for lettings in England."
la_not_valid_for_date: "%{la} does not exist on the tenancy start date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the tenancy start date" la_not_valid_for_date: "%{la} does not exist on the tenancy start date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the tenancy start date"

3
config/locales/validations/sales/property_information.en.yml

@ -33,9 +33,8 @@ en:
la: la:
not_in_england: "It looks like you have entered an address outside of England. Only create logs for sales in England." not_in_england: "It looks like you have entered an address outside of England. Only create logs for sales in England."
la_not_valid_for_date: "%{la} does not exist on the property sale date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the sale date" la_not_valid_for_date: "%{la} does not exist on the property sale date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the sale date"
uprn_confirmation: uprn_confirmation: # legacy question
not_in_england: "It looks like you have entered an address outside of England. Only create logs for sales in England." not_in_england: "It looks like you have entered an address outside of England. Only create logs for sales in England."
la_not_valid_for_date: "%{la} does not exist on the property sale date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the sale date"
uprn_selection: uprn_selection:
not_in_england: "It looks like you have entered an address outside of England. Only create logs for sales in England." not_in_england: "It looks like you have entered an address outside of England. Only create logs for sales in England."
la_not_valid_for_date: "%{la} does not exist on the property sale date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the sale date" la_not_valid_for_date: "%{la} does not exist on the property sale date, due to a change in local authority names and boundaries. Please enter the local authority name in use on the sale date"

9
spec/models/validations/property_validations_spec.rb

@ -221,7 +221,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to include(I18n.t("validations.lettings.property.la.not_in_england")) expect(log.errors["la"]).to include(I18n.t("validations.lettings.property.la.not_in_england"))
expect(log.errors["postcode_full"]).to include(I18n.t("validations.lettings.property.postcode_full.not_in_england")) expect(log.errors["postcode_full"]).to include(I18n.t("validations.lettings.property.postcode_full.not_in_england"))
expect(log.errors["uprn"]).to include(I18n.t("validations.lettings.property.uprn.not_in_england")) expect(log.errors["uprn"]).to include(I18n.t("validations.lettings.property.uprn.not_in_england"))
expect(log.errors["uprn_confirmation"]).to include(I18n.t("validations.lettings.property.uprn_confirmation.not_in_england"))
expect(log.errors["uprn_selection"]).to include(I18n.t("validations.lettings.property.uprn_selection.not_in_england")) expect(log.errors["uprn_selection"]).to include(I18n.t("validations.lettings.property.uprn_selection.not_in_england"))
expect(log.errors["startdate"]).to include(I18n.t("validations.lettings.property.startdate.postcode_not_in_england")) expect(log.errors["startdate"]).to include(I18n.t("validations.lettings.property.startdate.postcode_not_in_england"))
expect(log.errors["scheme_id"]).to be_empty expect(log.errors["scheme_id"]).to be_empty
@ -241,7 +240,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
end end
end end
@ -254,7 +252,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
expect(log.errors["startdate"]).to be_empty expect(log.errors["startdate"]).to be_empty
end end
@ -274,7 +271,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
end end
end end
@ -300,7 +296,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
expect(log.errors["startdate"]).to be_empty expect(log.errors["startdate"]).to be_empty
end end
@ -314,7 +309,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to include(I18n.t("validations.lettings.property.la.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["la"]).to include(I18n.t("validations.lettings.property.la.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["postcode_full"]).to include(I18n.t("validations.lettings.property.postcode_full.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["postcode_full"]).to include(I18n.t("validations.lettings.property.postcode_full.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["uprn"]).to include(I18n.t("validations.lettings.property.uprn.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["uprn"]).to include(I18n.t("validations.lettings.property.uprn.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["uprn_confirmation"]).to include(I18n.t("validations.lettings.property.uprn_confirmation.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["uprn_selection"]).to include(I18n.t("validations.lettings.property.uprn_selection.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["uprn_selection"]).to include(I18n.t("validations.lettings.property.uprn_selection.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["startdate"]).to include(I18n.t("validations.lettings.property.startdate.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["startdate"]).to include(I18n.t("validations.lettings.property.startdate.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["scheme_id"]).to be_empty expect(log.errors["scheme_id"]).to be_empty
@ -334,7 +328,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
end end
end end
@ -351,7 +344,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
end end
end end
@ -370,7 +362,6 @@ RSpec.describe Validations::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
end end
end end

6
spec/models/validations/sales/property_validations_spec.rb

@ -98,7 +98,6 @@ RSpec.describe Validations::Sales::PropertyValidations do
expect(log.errors["la"]).to include(I18n.t("validations.sales.property_information.la.not_in_england")) expect(log.errors["la"]).to include(I18n.t("validations.sales.property_information.la.not_in_england"))
expect(log.errors["postcode_full"]).to include(I18n.t("validations.sales.property_information.postcode_full.not_in_england")) expect(log.errors["postcode_full"]).to include(I18n.t("validations.sales.property_information.postcode_full.not_in_england"))
expect(log.errors["uprn"]).to include(I18n.t("validations.sales.property_information.uprn.not_in_england")) expect(log.errors["uprn"]).to include(I18n.t("validations.sales.property_information.uprn.not_in_england"))
expect(log.errors["uprn_confirmation"]).to include(I18n.t("validations.sales.property_information.uprn_confirmation.not_in_england"))
expect(log.errors["uprn_selection"]).to include(I18n.t("validations.sales.property_information.uprn_selection.not_in_england")) expect(log.errors["uprn_selection"]).to include(I18n.t("validations.sales.property_information.uprn_selection.not_in_england"))
expect(log.errors["saledate"]).to include(I18n.t("validations.sales.property_information.saledate.postcode_not_in_england")) expect(log.errors["saledate"]).to include(I18n.t("validations.sales.property_information.saledate.postcode_not_in_england"))
end end
@ -112,7 +111,6 @@ RSpec.describe Validations::Sales::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
expect(log.errors["saledate"]).to be_empty expect(log.errors["saledate"]).to be_empty
end end
@ -132,7 +130,6 @@ RSpec.describe Validations::Sales::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
expect(log.errors["saledate"]).to be_empty expect(log.errors["saledate"]).to be_empty
end end
@ -159,7 +156,6 @@ RSpec.describe Validations::Sales::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
expect(log.errors["saledate"]).to be_empty expect(log.errors["saledate"]).to be_empty
end end
@ -173,7 +169,6 @@ RSpec.describe Validations::Sales::PropertyValidations do
expect(log.errors["la"]).to include(I18n.t("validations.sales.property_information.la.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["la"]).to include(I18n.t("validations.sales.property_information.la.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["postcode_full"]).to include(I18n.t("validations.sales.property_information.postcode_full.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["postcode_full"]).to include(I18n.t("validations.sales.property_information.postcode_full.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["uprn"]).to include(I18n.t("validations.sales.property_information.uprn.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["uprn"]).to include(I18n.t("validations.sales.property_information.uprn.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["uprn_confirmation"]).to include(I18n.t("validations.sales.property_information.uprn_confirmation.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["uprn_selection"]).to include(I18n.t("validations.sales.property_information.uprn_selection.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["uprn_selection"]).to include(I18n.t("validations.sales.property_information.uprn_selection.la_not_valid_for_date", la: local_authority_inactive.name))
expect(log.errors["saledate"]).to include(I18n.t("validations.sales.property_information.saledate.la_not_valid_for_date", la: local_authority_inactive.name)) expect(log.errors["saledate"]).to include(I18n.t("validations.sales.property_information.saledate.la_not_valid_for_date", la: local_authority_inactive.name))
end end
@ -193,7 +188,6 @@ RSpec.describe Validations::Sales::PropertyValidations do
expect(log.errors["la"]).to be_empty expect(log.errors["la"]).to be_empty
expect(log.errors["postcode_full"]).to be_empty expect(log.errors["postcode_full"]).to be_empty
expect(log.errors["uprn"]).to be_empty expect(log.errors["uprn"]).to be_empty
expect(log.errors["uprn_confirmation"]).to be_empty
expect(log.errors["uprn_selection"]).to be_empty expect(log.errors["uprn_selection"]).to be_empty
expect(log.errors["saledate"]).to be_empty expect(log.errors["saledate"]).to be_empty
end end

Loading…
Cancel
Save