Browse Source

feat: remove instantiation, update tests

pull/1318/head
natdeanlewissoftwire 2 years ago
parent
commit
2a83fbc198
  1. 14
      app/models/validations/date_validations.rb
  2. 6
      spec/fixtures/complete_lettings_log.json
  3. 2
      spec/requests/lettings_logs_controller_spec.rb

14
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)

6
spec/fixtures/complete_lettings_log.json vendored

@ -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,

2
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

Loading…
Cancel
Save