|
|
|
@ -58,7 +58,7 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
record.mrcdate = Time.zone.local(2022, 2, 1) |
|
|
|
|
date_validator.validate_property_major_repairs(record) |
|
|
|
|
expect(record.errors["mrcdate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.mrcdate.before_tenancy_start")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.mrcdate.before_tenancy_start")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "must be before the tenancy start date" do |
|
|
|
@ -74,7 +74,7 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
date_validator.validate_property_major_repairs(record) |
|
|
|
|
date_validator.validate_startdate(record) |
|
|
|
|
expect(record.errors["mrcdate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.mrcdate.ten_years_before_tenancy_start")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.mrcdate.ten_years_before_tenancy_start")) |
|
|
|
|
expect(record.errors["startdate"]) |
|
|
|
|
.to include(match I18n.t("validations.setup.startdate.ten_years_after_mrc_date")) |
|
|
|
|
end |
|
|
|
@ -93,7 +93,7 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
record.mrcdate = Time.zone.local(2022, 1, 1) |
|
|
|
|
date_validator.validate_property_major_repairs(record) |
|
|
|
|
expect(record.errors["mrcdate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.mrcdate.not_first_let")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.mrcdate.not_first_let")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates that no major repair date is provided for a conversion" do |
|
|
|
@ -101,7 +101,7 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
record.mrcdate = Time.zone.local(2022, 1, 1) |
|
|
|
|
date_validator.validate_property_major_repairs(record) |
|
|
|
|
expect(record.errors["mrcdate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.mrcdate.not_first_let")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.mrcdate.not_first_let")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates that no major repair date is provided for a leased property" do |
|
|
|
@ -109,7 +109,7 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
record.mrcdate = Time.zone.local(2022, 1, 1) |
|
|
|
|
date_validator.validate_property_major_repairs(record) |
|
|
|
|
expect(record.errors["mrcdate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.mrcdate.not_first_let")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.mrcdate.not_first_let")) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -129,7 +129,7 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
record.voiddate = Time.zone.local(2022, 2, 1) |
|
|
|
|
date_validator.validate_property_void_date(record) |
|
|
|
|
expect(record.errors["voiddate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.void_date.before_tenancy_start")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.void_date.before_tenancy_start")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "must be before the tenancy start date" do |
|
|
|
@ -145,7 +145,7 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
date_validator.validate_property_void_date(record) |
|
|
|
|
date_validator.validate_startdate(record) |
|
|
|
|
expect(record.errors["voiddate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.void_date.ten_years_before_tenancy_start")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.void_date.ten_years_before_tenancy_start")) |
|
|
|
|
expect(record.errors["startdate"]) |
|
|
|
|
.to include(match I18n.t("validations.setup.startdate.ten_years_after_void_date")) |
|
|
|
|
end |
|
|
|
@ -164,9 +164,9 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
record.voiddate = Time.zone.local(2022, 2, 1) |
|
|
|
|
date_validator.validate_property_void_date(record) |
|
|
|
|
expect(record.errors["voiddate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.void_date.after_mrcdate")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.void_date.after_mrcdate")) |
|
|
|
|
expect(record.errors["mrcdate"]) |
|
|
|
|
.to include(match I18n.t("validations.property.mrcdate.before_void_date")) |
|
|
|
|
.to include(match I18n.t("validations.lettings.date.mrcdate.before_void_date")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "must be before major repairs date" do |
|
|
|
|