@ -74,7 +74,7 @@ RSpec.describe LocationDeactivationPeriod do
location.location_deactivation_periods.clear
location.location_deactivation_periods.clear
validator.validate(record)
validator.validate(record)
start_date=startdate.to_formatted_s(:govuk_date)
start_date=startdate.to_formatted_s(:govuk_date)
expect(record.errors[:deactivation_date]).toinclude"The location cannot be deactivated before #{start_date}, the start of the collection year when it was created"
expect(record.errors[:deactivation_date]).toinclude"The location cannot be deactivated before #{start_date}, the date when it was first available"
context"with a deactivation date in the previous collection period"do
it"adds an error"do
record.deactivation_date=now-1.year
scheme.scheme_deactivation_periods.clear
validator.validate(record)
expect(record.errors[:deactivation_date]).toinclude"The scheme cannot be deactivated before 1 April 2023, the start of the collection year when it was created"