diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb index f97711562..45a24b964 100644 --- a/spec/models/lettings_log_spec.rb +++ b/spec/models/lettings_log_spec.rb @@ -2396,6 +2396,10 @@ RSpec.describe LettingsLog do expected_content.sub!(/\{location_id\}/, location["id"].to_s) end + after do + Timecop.unfreeze + end + context "with a support user" do let(:csv_export_file) { File.open("spec/fixtures/files/lettings_logs_download.csv", "r:UTF-8") } diff --git a/spec/models/location_spec.rb b/spec/models/location_spec.rb index 2a23f0299..01185249a 100644 --- a/spec/models/location_spec.rb +++ b/spec/models/location_spec.rb @@ -119,6 +119,10 @@ RSpec.describe Location, type: :model do Timecop.freeze(2022, 6, 7) end + after do + Timecop.unfreeze + end + context "when there have not been any previous deactivations" do it "returns active if the location has no deactivation records" do expect(location.status).to eq(:active) diff --git a/spec/models/scheme_spec.rb b/spec/models/scheme_spec.rb index 59ac34de4..d95d867dc 100644 --- a/spec/models/scheme_spec.rb +++ b/spec/models/scheme_spec.rb @@ -99,6 +99,10 @@ RSpec.describe Scheme, type: :model do Timecop.freeze(2022, 6, 7) end + after do + Timecop.unfreeze + end + context "when there have not been any previous deactivations" do it "returns active if the scheme is not deactivated" do expect(scheme.status).to eq(:active) diff --git a/spec/requests/locations_controller_spec.rb b/spec/requests/locations_controller_spec.rb index ff3d77ab0..605c357b7 100644 --- a/spec/requests/locations_controller_spec.rb +++ b/spec/requests/locations_controller_spec.rb @@ -1249,6 +1249,10 @@ RSpec.describe LocationsController, type: :request do patch "/schemes/#{scheme.id}/locations/#{location.id}/new-deactivation", params: end + after do + Timecop.unfreeze + end + context "with default date" do let(:params) { { location: { deactivation_date_type: "default", deactivation_date: } } } @@ -1278,6 +1282,10 @@ RSpec.describe LocationsController, type: :request do patch "/schemes/#{scheme.id}/locations/#{location.id}/deactivate", params: end + after do + Timecop.unfreeze + end + it "updates existing location with valid deactivation date and renders location page" do follow_redirect! expect(response).to have_http_status(:ok) @@ -1402,6 +1410,10 @@ RSpec.describe LocationsController, type: :request do get "/schemes/#{scheme.id}/locations/#{location.id}" end + after do + Timecop.unfreeze + end + context "with active location" do let(:add_deactivations) {} diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 237df9785..59d044050 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -256,6 +256,10 @@ RSpec.describe SchemesController, type: :request do get "/schemes/#{scheme.id}" end + after do + Timecop.unfreeze + end + context "with active scheme" do let(:add_deactivations) {} @@ -1776,6 +1780,10 @@ RSpec.describe SchemesController, type: :request do patch "/schemes/#{scheme.id}/new-deactivation", params: end + after do + Timecop.unfreeze + end + context "with default date" do let(:params) { { scheme: { deactivation_date_type: "default", deactivation_date: } } } @@ -1805,6 +1813,10 @@ RSpec.describe SchemesController, type: :request do patch "/schemes/#{scheme.id}/deactivate", params: end + after do + Timecop.unfreeze + end + it "updates existing scheme with valid deactivation date and renders scheme page" do follow_redirect! follow_redirect! diff --git a/spec/services/exports/lettings_log_export_service_spec.rb b/spec/services/exports/lettings_log_export_service_spec.rb index ee17edf0e..044fe6c93 100644 --- a/spec/services/exports/lettings_log_export_service_spec.rb +++ b/spec/services/exports/lettings_log_export_service_spec.rb @@ -37,6 +37,10 @@ RSpec.describe Exports::LettingsLogExportService do allow(FormHandler.instance).to receive(:get_form).with("current_lettings").and_return(real_2022_2023_form) end + after do + Timecop.unfreeze + end + context "when exporting daily lettings logs in XML" do context "and no lettings logs is available for export" do it "generates a master manifest with the correct name" do