|
|
|
@ -205,4 +205,36 @@ RSpec.describe Validations::SoftValidations do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "major repairs date soft validations" do |
|
|
|
|
context "when the major repairs date is within 10 years of the tenancy start date" do |
|
|
|
|
it "shows the interruption screen" do |
|
|
|
|
record.update!(startdate: Time.zone.local(2022, 2, 1), mrcdate: Time.zone.local(2013, 2, 1)) |
|
|
|
|
expect(record.major_repairs_date_in_soft_range?).to be true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the major repairs date is less than 2 years before the tenancy start date" do |
|
|
|
|
it "does not show the interruption screen" do |
|
|
|
|
record.update!(startdate: Time.zone.local(2022, 2, 1), mrcdate: Time.zone.local(2021, 2, 1)) |
|
|
|
|
expect(record.major_repairs_date_in_soft_range?).to be false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "void date soft validations" do |
|
|
|
|
context "when the void date is within 10 years of the tenancy start date" do |
|
|
|
|
it "shows the interruption screen" do |
|
|
|
|
record.update!(startdate: Time.zone.local(2022, 2, 1), voiddate: Time.zone.local(2013, 2, 1)) |
|
|
|
|
expect(record.voiddate_date_in_soft_range?).to be true |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the void date is less than 2 years before the tenancy start date" do |
|
|
|
|
it "does not show the interruption screen" do |
|
|
|
|
record.update!(startdate: Time.zone.local(2022, 2, 1), voiddate: Time.zone.local(2021, 2, 1)) |
|
|
|
|
expect(record.voiddate_date_in_soft_range?).to be false |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|