Browse Source

CLDC-3691: Extract copy - lettings setup validations (#2739)

pull/2737/head^2
Manny Dinssa 2 months ago committed by GitHub
parent
commit
576d0900fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 80
      app/models/validations/setup_validations.rb
  2. 34
      config/locales/en.yml
  3. 53
      config/locales/validations/lettings/setup.en.yml
  4. 18
      spec/models/validations/setup_validations_spec.rb

80
app/models/validations/setup_validations.rb

@ -16,42 +16,42 @@ module Validations::SetupValidations
end
if record.startdate > Time.zone.today + 14.days
record.errors.add :startdate, I18n.t("validations.setup.startdate.later_than_14_days_after")
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.not_within.next_two_weeks")
end
end
def validate_organisation(record)
assigned_to, managing_organisation, owning_organisation = record.values_at("assigned_to", "managing_organisation", "owning_organisation")
unless [assigned_to, managing_organisation, owning_organisation].any?(&:blank?) || ((assigned_to.organisation.absorbed_organisations + [assigned_to.organisation]) & [managing_organisation, owning_organisation]).present?
record.errors.add :assigned_to, I18n.t("validations.setup.assigned_to.invalid")
record.errors.add :owning_organisation_id, I18n.t("validations.setup.owning_organisation.invalid")
record.errors.add :managing_organisation_id, I18n.t("validations.setup.managing_organisation.invalid")
record.errors.add :assigned_to, I18n.t("validations.lettings.setup.assigned_to.invalid")
record.errors.add :owning_organisation_id, I18n.t("validations.lettings.setup.owning_organisation.invalid")
record.errors.add :managing_organisation_id, I18n.t("validations.lettings.setup.managing_organisation.invalid")
end
return unless record.startdate
if owning_organisation.present?
if owning_organisation&.merge_date.present? && owning_organisation.merge_date <= record.startdate
record.errors.add :owning_organisation_id, I18n.t("validations.setup.owning_organisation.inactive_merged_organisation",
record.errors.add :owning_organisation_id, I18n.t("validations.lettings.setup.owning_organisation.inactive.merged_organisation",
owning_organisation: record.owning_organisation.name,
owning_organisation_merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
owning_absorbing_organisation: record.owning_organisation.absorbing_organisation.name)
merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
absorbing_organisation: record.owning_organisation.absorbing_organisation.name)
elsif owning_organisation&.absorbed_organisations.present? && owning_organisation.available_from.present? && owning_organisation.available_from.to_date > record.startdate.to_date
record.errors.add :owning_organisation_id, I18n.t("validations.setup.owning_organisation.inactive_absorbing_organisation",
record.errors.add :owning_organisation_id, I18n.t("validations.lettings.setup.owning_organisation.inactive.absorbing_organisation",
owning_organisation: record.owning_organisation.name,
owning_organisation_available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
end
end
if managing_organisation.present?
if managing_organisation&.merge_date.present? && managing_organisation.merge_date <= record.startdate
record.errors.add :managing_organisation_id, I18n.t("validations.setup.managing_organisation.inactive_merged_organisation",
record.errors.add :managing_organisation_id, I18n.t("validations.lettings.setup.managing_organisation.inactive.merged_organisation",
managing_organisation: record.managing_organisation.name,
managing_organisation_merge_date: record.managing_organisation.merge_date.to_formatted_s(:govuk_date),
managing_absorbing_organisation: record.managing_organisation.absorbing_organisation.name)
merge_date: record.managing_organisation.merge_date.to_formatted_s(:govuk_date),
absorbing_organisation: record.managing_organisation.absorbing_organisation.name)
elsif managing_organisation&.absorbed_organisations.present? && managing_organisation.available_from.present? && managing_organisation.available_from.to_date > record.startdate.to_date
record.errors.add :managing_organisation_id, I18n.t("validations.setup.managing_organisation.inactive_absorbing_organisation",
record.errors.add :managing_organisation_id, I18n.t("validations.lettings.setup.managing_organisation.inactive.absorbing_organisation",
managing_organisation: record.managing_organisation.name,
managing_organisation_available_from: record.managing_organisation.available_from.to_formatted_s(:govuk_date))
available_from: record.managing_organisation.available_from.to_formatted_s(:govuk_date))
end
end
end
@ -68,7 +68,7 @@ module Validations::SetupValidations
def validate_irproduct_other(record)
if intermediate_product_rent_type?(record) && record.irproduct_other.blank?
record.errors.add :irproduct_other, I18n.t("validations.setup.intermediate_rent_product_name.blank")
record.errors.add :irproduct_other, I18n.t("validations.lettings.setup.intermediate_rent_product_name.blank")
end
end
@ -76,13 +76,13 @@ module Validations::SetupValidations
return unless record.scheme
unless record.scheme.locations.confirmed.any?
record.errors.add :scheme_id, :no_completed_locations, message: I18n.t("validations.scheme.no_completed_locations")
record.errors.add :scheme_id, :no_completed_locations, message: I18n.t("validations.lettings.setup.scheme.no_completed_locations")
end
end
def validate_scheme(record)
if record.scheme&.status == :incomplete
record.errors.add :scheme_id, :incomplete, message: I18n.t("validations.setup.scheme.incomplete")
record.errors.add :scheme_id, :incomplete, message: I18n.t("validations.lettings.setup.scheme.incomplete")
end
scheme_during_startdate_validation(record)
@ -93,8 +93,8 @@ module Validations::SetupValidations
location_during_startdate_validation(record)
if record.location&.status == :incomplete
record.errors.add :location_id, :incomplete, message: I18n.t("validations.setup.location.incomplete")
record.errors.add :scheme_id, :incomplete, message: I18n.t("validations.setup.location.incomplete")
record.errors.add :location_id, :incomplete, message: I18n.t("validations.lettings.setup.location.incomplete")
record.errors.add :scheme_id, :incomplete, message: I18n.t("validations.lettings.setup.location.incomplete")
end
end
@ -102,7 +102,7 @@ module Validations::SetupValidations
return if record.skip_dpo_validation
if record.managing_organisation_id_changed? && record.managing_organisation.present? && !record.managing_organisation.data_protection_confirmed?
record.errors.add :managing_organisation_id, I18n.t("validations.setup.managing_organisation.data_sharing_agreement_not_signed")
record.errors.add :managing_organisation_id, I18n.t("validations.lettings.setup.managing_organisation.data_sharing_agreement_not_signed")
end
end
@ -129,7 +129,7 @@ private
if FormHandler.instance.lettings_in_crossover_period?
I18n.t(
"validations.setup.startdate.previous_and_current_collection_year",
"validations.lettings.setup.startdate.must_be_within.previous_and_current_collection_year",
previous_start_year_short: previous_collection_start_date.strftime("%Y"),
previous_end_year_short: previous_collection_end_date.strftime("%Y"),
previous_start_year_long: previous_collection_start_date.strftime("#{previous_collection_start_date.day.ordinalize} %B %Y"),
@ -138,7 +138,7 @@ private
)
else
I18n.t(
"validations.setup.startdate.current_collection_year",
"validations.lettings.setup.startdate.must_be_within.current_collection_year",
current_start_year_short: current_collection_start_date.strftime("%Y"),
current_end_year_short: current_collection_end_date.strftime("%Y"),
current_start_year_long: current_collection_start_date.strftime("#{current_collection_start_date.day.ordinalize} %B %Y"),
@ -153,20 +153,20 @@ private
def add_same_merge_organisation_error(record)
if merged_owning_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_merged_organisations_start_date.same_organisation",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_merged_organisations_start_date.same_organisation",
owning_organisation: record.owning_organisation.name,
owning_organisation_merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
owning_absorbing_organisation: record.owning_organisation.absorbing_organisation.name)
merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
absorbing_organisation: record.owning_organisation.absorbing_organisation.name)
elsif absorbing_owning_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_absorbing_organisations_start_date.same_organisation",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_absorbing_organisations_start_date.same_organisation",
owning_organisation: record.owning_organisation.name,
owning_organisation_available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
end
end
def add_same_merge_error(record)
if merged_owning_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_merged_organisations_start_date.same_merge",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_merged_organisations_start_date.same_merge",
owning_organisation: record.owning_organisation.name,
managing_organisation: record.managing_organisation.name,
owning_organisation_merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
@ -176,7 +176,7 @@ private
def add_merged_organisations_errors(record)
if merged_owning_organisation_inactive?(record) && merged_managing_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_merged_organisations_start_date.different_merge",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_merged_organisations_start_date.different_merge",
owning_organisation: record.owning_organisation.name,
owning_organisation_merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
owning_absorbing_organisation: record.owning_organisation.absorbing_organisation.name,
@ -185,39 +185,39 @@ private
managing_absorbing_organisation: record.managing_organisation.absorbing_organisation.name)
else
if merged_owning_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_merged_organisations_start_date.owning_organisation",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_merged_organisations_start_date.owning_organisation",
owning_organisation: record.owning_organisation.name,
owning_organisation_merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
owning_absorbing_organisation: record.owning_organisation.absorbing_organisation.name)
merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
absorbing_organisation: record.owning_organisation.absorbing_organisation.name)
end
if merged_managing_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_merged_organisations_start_date.managing_organisation",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_merged_organisations_start_date.managing_organisation",
managing_organisation: record.managing_organisation.name,
managing_organisation_merge_date: record.managing_organisation.merge_date.to_formatted_s(:govuk_date),
managing_absorbing_organisation: record.managing_organisation.absorbing_organisation.name)
merge_date: record.managing_organisation.merge_date.to_formatted_s(:govuk_date),
absorbing_organisation: record.managing_organisation.absorbing_organisation.name)
end
end
end
def add_absorbing_organisations_errors(record)
if absorbing_owning_organisation_inactive?(record) && absorbing_managing_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_absorbing_organisations_start_date.different_organisations",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_absorbing_organisations_start_date.different_organisations",
owning_organisation: record.owning_organisation.name,
owning_organisation_active_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date),
managing_organisation: record.managing_organisation.name,
managing_organisation_active_from: record.managing_organisation.available_from.to_formatted_s(:govuk_date))
else
if absorbing_owning_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_absorbing_organisations_start_date.owning_organisation",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_absorbing_organisations_start_date.owning_organisation",
owning_organisation: record.owning_organisation.name,
owning_organisation_available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
end
if absorbing_managing_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_absorbing_organisations_start_date.managing_organisation",
record.errors.add :startdate, I18n.t("validations.lettings.setup.startdate.invalid_absorbing_organisations_start_date.managing_organisation",
managing_organisation: record.managing_organisation.name,
managing_organisation_available_from: record.managing_organisation.available_from.to_formatted_s(:govuk_date))
available_from: record.managing_organisation.available_from.to_formatted_s(:govuk_date))
end
end
end

34
config/locales/en.yml

@ -281,33 +281,14 @@ en:
invalid: "Role must be data accessor, data provider or data coordinator."
setup:
intermediate_rent_product_name:
blank: "Enter name of other intermediate rent product."
saledate:
year_not_two_or_four_digits: "Sale completion year must be 2 or 4 digits."
type:
percentage_bought_must_be_at_least_threshold: "The minimum increase in equity while staircasing is %{threshold}% for this shared ownership type."
startdate:
current_collection_year:
"Enter a date within the %{current_start_year_short} to %{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}."
previous_and_current_collection_year:
"Enter a date within the %{previous_start_year_short} to %{previous_end_year_short} or %{previous_end_year_short} to %{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}."
later_than_14_days_after: "The tenancy start date must not be later than 14 days from today’s date."
before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme."
year_not_two_or_four_digits: "Tenancy start year must be 2 or 4 digits."
invalid_merged_organisations_start_date:
same_organisation: "Enter a date when the owning and managing organisation was active. %{owning_organisation} became inactive on %{owning_organisation_merge_date} and was replaced by %{owning_absorbing_organisation}."
same_merge: "Enter a date when the owning and managing organisations were active. %{owning_organisation} and %{managing_organisation} became inactive on %{owning_organisation_merge_date} and were replaced by %{owning_absorbing_organisation}."
owning_organisation: "Enter a date when the owning organisation was active. %{owning_organisation} became inactive on %{owning_organisation_merge_date} and was replaced by %{owning_absorbing_organisation}."
managing_organisation: "Enter a date when the managing organisation was active. %{managing_organisation} became inactive on %{managing_organisation_merge_date} and was replaced by %{managing_absorbing_organisation}."
different_merge: "Enter a date when the owning and managing organisations were active. %{owning_organisation} became inactive on %{owning_organisation_merge_date} and was replaced by %{owning_absorbing_organisation}. %{managing_organisation} became inactive on %{managing_organisation_merge_date} and was replaced by %{managing_absorbing_organisation}."
invalid_absorbing_organisations_start_date:
same_organisation: "Enter a date when the owning and managing organisation was active. %{owning_organisation} became active on %{owning_organisation_available_from}."
owning_organisation: "Enter a date when the owning organisation was active. %{owning_organisation} became active on %{owning_organisation_available_from}."
managing_organisation: "Enter a date when the managing organisation was active. %{managing_organisation} became active on %{managing_organisation_available_from}."
different_organisations: "Enter a date when the owning and managing organisations were active. %{owning_organisation} became active on %{owning_organisation_active_from}, and %{managing_organisation} became active on %{managing_organisation_active_from}."
location:
deactivated:
startdate: "The location %{postcode} is inactive on this date. Enter another date or choose another location."
@ -329,17 +310,7 @@ en:
startdate: "The scheme %{name} has no locations that are active on this date. Enter another date or choose another scheme."
scheme_id: "The scheme %{name} has no locations that are active on this date. Enter another date or choose another scheme."
owning_organisation:
invalid: "Please select the owning organisation or managing organisation that you belong to."
data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation."
inactive_merged_organisation: "The owning organisation must be active on the tenancy start date. %{owning_organisation} became inactive on %{owning_organisation_merge_date} and was replaced by %{owning_absorbing_organisation}."
inactive_absorbing_organisation: "The owning organisation must be active on the tenancy start date. %{owning_organisation} became active on %{owning_organisation_available_from}."
managing_organisation:
invalid: "Please select the owning organisation or managing organisation that you belong to."
data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the managing organisation."
inactive_merged_organisation: "The managing organisation must be active on the tenancy start date. %{managing_organisation} became inactive on %{managing_organisation_merge_date} and was replaced by %{managing_absorbing_organisation}."
inactive_absorbing_organisation: "The managing organisation must be active on the tenancy start date. %{managing_organisation} became active on %{managing_organisation_available_from}."
assigned_to:
invalid: "Please select the owning organisation or managing organisation that you belong to."
lettype:
general_needs_mismatch: "Lettings type must be a general needs type because you selected general needs when uploading the file."
supported_housing_mismatch: "Lettings type must be a supported housing type because you selected supported housing when uploading the file."
@ -348,10 +319,6 @@ en:
needstype:
lettype_not_general_needs: "This letting type is supported housing, but the needs type is general needs. Change either the needs type or the letting type."
lettype_not_supported_housing: "This letting type is general needs, but the needs type is supported housing. Change either the needs type or the letting type."
location:
incomplete: "This location is incomplete. Select another location or update this one."
scheme:
incomplete: "This scheme is incomplete. Select another scheme or update this one."
property:
uprn:
@ -603,7 +570,6 @@ en:
during_deactivated_period: "The scheme is already deactivated during this date, please enter a different date."
owning_organisation:
does_not_own_stock: "Enter an organisation that owns housing stock."
no_completed_locations: "This scheme cannot be chosen as it has no completed locations."
location:
postcode_blank: "Enter a postcode."

53
config/locales/validations/lettings/setup.en.yml

@ -0,0 +1,53 @@
en:
validations:
lettings:
setup:
startdate:
not_within:
next_two_weeks: "The tenancy start date must not be later than 14 days from today’s date."
must_be_within:
current_collection_year:
"Enter a date within the %{current_start_year_short} to %{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}."
previous_and_current_collection_year:
"Enter a date within the %{previous_start_year_short} to %{previous_end_year_short} or %{previous_end_year_short} to %{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}."
invalid_merged_organisations_start_date:
same_organisation: "Enter a date when the owning and managing organisation was active. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."
same_merge: "Enter a date when the owning and managing organisations were active. %{owning_organisation} and %{managing_organisation} became inactive on %{owning_organisation_merge_date} and were replaced by %{owning_absorbing_organisation}."
owning_organisation: "Enter a date when the owning organisation was active. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."
managing_organisation: "Enter a date when the managing organisation was active. %{managing_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."
different_merge: "Enter a date when the owning and managing organisations were active. %{owning_organisation} became inactive on %{owning_organisation_merge_date} and was replaced by %{owning_absorbing_organisation}. %{managing_organisation} became inactive on %{managing_organisation_merge_date} and was replaced by %{managing_absorbing_organisation}."
invalid_absorbing_organisations_start_date:
same_organisation: "Enter a date when the owning and managing organisation was active. %{owning_organisation} became active on %{available_from}."
owning_organisation: "Enter a date when the owning organisation was active. %{owning_organisation} became active on %{available_from}."
managing_organisation: "Enter a date when the managing organisation was active. %{managing_organisation} became active on %{available_from}."
different_organisations: "Enter a date when the owning and managing organisations were active. %{owning_organisation} became active on %{owning_organisation_active_from}, and %{managing_organisation} became active on %{managing_organisation_active_from}."
assigned_to:
invalid: "Please select the owning organisation or managing organisation that you belong to."
owning_organisation:
invalid: "Please select the owning organisation or managing organisation that you belong to."
inactive:
merged_organisation:
"The owning organisation must be active on the tenancy start date. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."
absorbing_organisation:
"The owning organisation must be active on the tenancy start date. %{owning_organisation} became active on %{available_from}."
managing_organisation:
invalid: "Please select the owning organisation or managing organisation that you belong to."
data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the managing organisation."
inactive:
merged_organisation:
"The managing organisation must be active on the tenancy start date. %{managing_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."
absorbing_organisation:
"The managing organisation must be active on the tenancy start date. %{managing_organisation} became active on %{available_from}."
intermediate_rent_product_name:
blank: "Enter name of other intermediate rent product."
scheme:
incomplete: "This scheme is incomplete. Select another scheme or update this one."
no_completed_locations: "This scheme cannot be chosen as it has no completed locations."
location:
incomplete: "This location is incomplete. Select another location or update this one."

18
spec/models/validations/setup_validations_spec.rb

@ -149,7 +149,7 @@ RSpec.describe Validations::SetupValidations do
it "adds an error to startdate" do
record.startdate = Time.zone.local(2024, 3, 31)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).to include(match I18n.t("validations.setup.startdate.later_than_14_days_after"))
expect(record.errors["startdate"]).to include(match I18n.t("validations.lettings.setup.startdate.not_within.next_two_weeks"))
end
context "and the attempted startdate is in a future collection year" do
@ -158,7 +158,7 @@ RSpec.describe Validations::SetupValidations do
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"].length).to be >= 2
expect(record.errors["startdate"][0]).to eq("Enter a date within the 2023 to 2024 collection year, which is between 1st April 2023 and 31st March 2024.")
expect(record.errors["startdate"][1]).to eq(I18n.t("validations.setup.startdate.later_than_14_days_after"))
expect(record.errors["startdate"][1]).to eq(I18n.t("validations.lettings.setup.startdate.not_within.next_two_weeks"))
end
end
end
@ -401,7 +401,7 @@ RSpec.describe Validations::SetupValidations do
record.irproduct_other = nil
setup_validator.validate_irproduct_other(record)
expect(record.errors["irproduct_other"])
.to include(match I18n.t("validations.setup.intermediate_rent_product_name.blank"))
.to include(match I18n.t("validations.lettings.setup.intermediate_rent_product_name.blank"))
end
it "adds an error when the intermediate rent product name is blank but the rent type was given as other intermediate rent product" do
@ -409,7 +409,7 @@ RSpec.describe Validations::SetupValidations do
record.irproduct_other = ""
setup_validator.validate_irproduct_other(record)
expect(record.errors["irproduct_other"])
.to include(match I18n.t("validations.setup.intermediate_rent_product_name.blank"))
.to include(match I18n.t("validations.lettings.setup.intermediate_rent_product_name.blank"))
end
it "Does not add an error when the intermediate rent product name is provided and the rent type was given as other intermediate rent product" do
@ -572,7 +572,7 @@ RSpec.describe Validations::SetupValidations do
it "adds an error to scheme_id" do
record.scheme = scheme
setup_validator.validate_scheme(record)
expect(record.errors["scheme_id"]).to include(I18n.t("validations.setup.scheme.incomplete"))
expect(record.errors["scheme_id"]).to include(I18n.t("validations.lettings.setup.scheme.incomplete"))
end
end
end
@ -748,9 +748,9 @@ RSpec.describe Validations::SetupValidations do
record.managing_organisation = other_organisation
setup_validator.validate_organisation(record)
expect(record.errors["assigned_to"]).to include(I18n.t("validations.setup.assigned_to.invalid"))
expect(record.errors["owning_organisation_id"]).to include(I18n.t("validations.setup.owning_organisation.invalid"))
expect(record.errors["managing_organisation_id"]).to include(I18n.t("validations.setup.managing_organisation.invalid"))
expect(record.errors["assigned_to"]).to include(I18n.t("validations.lettings.setup.assigned_to.invalid"))
expect(record.errors["owning_organisation_id"]).to include(I18n.t("validations.lettings.setup.owning_organisation.invalid"))
expect(record.errors["managing_organisation_id"]).to include(I18n.t("validations.lettings.setup.managing_organisation.invalid"))
end
it "does not validate if either managing or owning organisation is the same as current user organisation" do
@ -902,7 +902,7 @@ RSpec.describe Validations::SetupValidations do
record.scheme = scheme
setup_validator.validate_scheme_has_confirmed_locations_validation(record)
expect(record.errors["scheme_id"])
.to include(match I18n.t("validations.scheme.no_completed_locations"))
.to include(match I18n.t("validations.lettings.setup.scheme.no_completed_locations"))
end
end

Loading…
Cancel
Save