From 2a83fbc198f3c29b1f2a4fce9c33f1de677456e2 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Mon, 20 Feb 2023 17:30:49 +0000 Subject: [PATCH] feat: remove instantiation, update tests --- app/models/validations/date_validations.rb | 14 +++++++------- spec/fixtures/complete_lettings_log.json | 6 +++--- spec/requests/lettings_logs_controller_spec.rb | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/validations/date_validations.rb b/app/models/validations/date_validations.rb index de264f07e..379ab9bb5 100644 --- a/app/models/validations/date_validations.rb +++ b/app/models/validations/date_validations.rb @@ -69,31 +69,31 @@ module Validations::DateValidations private def previous_collection_start_suffix - @previous_collection_start_suffix ||= previous_collection_start_date.strftime("%y").to_i + previous_collection_start_date.strftime("%y").to_i end def current_collection_start_suffix - @current_collection_start_suffix ||= current_collection_start_date.strftime("%y").to_i + current_collection_start_date.strftime("%y").to_i end def previous_collection_start_date - @previous_collection_start_date ||= FormHandler.instance.lettings_forms["previous_lettings"].start_date + FormHandler.instance.lettings_forms["previous_lettings"].start_date end def previous_collection_end_date - @previous_collection_end_date ||= FormHandler.instance.lettings_forms["previous_lettings"].end_date + FormHandler.instance.lettings_forms["previous_lettings"].end_date end def current_collection_start_date - @current_collection_start_date ||= FormHandler.instance.lettings_forms["current_lettings"].start_date + FormHandler.instance.lettings_forms["current_lettings"].start_date end def current_collection_end_date - @current_collection_end_date ||= FormHandler.instance.lettings_forms["current_lettings"].end_date + FormHandler.instance.lettings_forms["current_lettings"].end_date end def next_collection_start_date - @next_collection_start_date ||= FormHandler.instance.lettings_forms["next_lettings"].start_date + FormHandler.instance.lettings_forms["next_lettings"].start_date end def is_rsnvac_first_let?(record) diff --git a/spec/fixtures/complete_lettings_log.json b/spec/fixtures/complete_lettings_log.json index f97d2f37f..9369c1f41 100644 --- a/spec/fixtures/complete_lettings_log.json +++ b/spec/fixtures/complete_lettings_log.json @@ -89,14 +89,14 @@ "hb": 9, "hbrentshortfall": null, "property_relet": null, - "mrcdate": "2021-05-07T00:00:00.000+01:00", + "mrcdate": "2022-05-07T00:00:00.000+01:00", "incref": null, - "startdate": "2021-06-06T00:00:00.000+01:00", + "startdate": "2022-06-06T00:00:00.000+01:00", "armedforces": 2, "first_time_property_let_as_social_housing": 0, "unitletas": 1, "builtype": 1, - "voiddate": "2021-05-05T00:00:00.000+01:00", + "voiddate": "2022-05-05T00:00:00.000+01:00", "owning_organisation_id": 1, "managing_organisation_id": 1, "renttype": 2, diff --git a/spec/requests/lettings_logs_controller_spec.rb b/spec/requests/lettings_logs_controller_spec.rb index 9db2c3236..5797471c9 100644 --- a/spec/requests/lettings_logs_controller_spec.rb +++ b/spec/requests/lettings_logs_controller_spec.rb @@ -51,7 +51,7 @@ RSpec.describe LettingsLogsController, type: :request do end before do - Timecop.freeze(Time.utc(2022, 2, 8)) + Timecop.freeze(Time.utc(2023, 1, 1)) post "/lettings-logs", headers:, params: params.to_json end