* Add a test to clear the voiddate for unresolved logs
* feat: add reset_voiddate method
* feat: only reset voiddate if log is unresolved
* test: check voiddate not cleared if log is resolved
* feat: remove redundant check for startdate and voiddate being non-nil
* feat: make reset_voiddate into a bang method
* test: add tests for clearing mrcdate
* feat: create reset_mcrdate! method
* refactor
* reset rent values when rent validation triggers
* refactor tests
* Test for checking that other validations aren't impacted
Co-authored-by: Sam Seed <sam.seed@softwire.com>
.toraise_error(ActiveRecord::RecordInvalid,/Enter a reason for vacancy that is not 'first let' if unit has been previously let as social housing/)
end
end
end
context"when the log is resolved"do
context"and the new startdate triggers void date validation"do
it"doesn't clear void date value"do
expect{lettings_log.update!(startdate:Time.zone.yesterday)}.toraise_error(ActiveRecord::RecordInvalid,/Enter a void date that is before the tenancy start date/)
context"and the new startdate triggers major repairs date validation"do
it"doesn't clear major repairs date value"do
expect{lettings_log.update!(startdate:Time.zone.yesterday)}.toraise_error(ActiveRecord::RecordInvalid,/Enter a major repairs date that is before the tenancy start date/)