|
|
|
@ -33,6 +33,19 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
expect(record.errors["startdate"]).to be_empty |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates that the tenancy start date is later than or 14 days before the current date" do |
|
|
|
|
record.startdate = Time.zone.today - 15.days |
|
|
|
|
setup_validator.validate_startdate(record) |
|
|
|
|
expect(record.errors["startdate"]) |
|
|
|
|
.to include(match I18n.t("validations.setup.startdate.later_than_or_14_days_before")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "produces no error when the tenancy start date is later than or 14 days before the current date" do |
|
|
|
|
record.startdate = Time.zone.today - 7.days |
|
|
|
|
setup_validator.validate_startdate(record) |
|
|
|
|
expect(record.errors["startdate"]).to be_empty |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "validates that the tenancy start date is before the end date of the chosen scheme if it has an end date" do |
|
|
|
|
record.startdate = Time.zone.today - 3.days |
|
|
|
|
record.scheme = scheme |
|
|
|
@ -54,21 +67,6 @@ RSpec.describe Validations::DateValidations do
|
|
|
|
|
setup_validator.validate_startdate(record) |
|
|
|
|
expect(record.errors["startdate"]).to be_empty |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# it "validates that tenancy start date is less than 730 days away from the void date" do |
|
|
|
|
# record.startdate = Time.zone.today |
|
|
|
|
# record.voiddate = Time.zone.today - 3.years |
|
|
|
|
# setup_validator.validate_startdate(record) |
|
|
|
|
# expect(record.errors["startdate"]) |
|
|
|
|
# .to include(match I18n.t("validations.setup.startdate.voiddate_difference")) |
|
|
|
|
# end |
|
|
|
|
|
|
|
|
|
# it "produces no error tenancy start date is less than 730 days away from the void date" do |
|
|
|
|
# record.startdate = Time.zone.today |
|
|
|
|
# record.voiddate = Time.zone.today - 6.months |
|
|
|
|
# setup_validator.validate_startdate(record) |
|
|
|
|
# expect(record.errors["startdate"]).to be_empty |
|
|
|
|
# end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "major repairs date" do |
|
|
|
|