|
|
|
|
@ -51,7 +51,7 @@ RSpec.describe LocationsHelper do
|
|
|
|
|
let(:location) { FactoryBot.create(:location, startdate: nil) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(2023, 10, 10) |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 10, 10)) |
|
|
|
|
allow(FormHandler.instance).to receive(:lettings_in_crossover_period?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
@ -228,7 +228,7 @@ RSpec.describe LocationsHelper do
|
|
|
|
|
context "with previous deactivations" do |
|
|
|
|
context "and all reactivated deactivations" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2023, 11, 10)) |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 11, 10)) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 8, 10), reactivation_date: Time.zone.local(2022, 9, 1), location:) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 9, 15), reactivation_date: Time.zone.local(2022, 9, 28), location:) |
|
|
|
|
Timecop.return |
|
|
|
|
@ -244,7 +244,7 @@ RSpec.describe LocationsHelper do
|
|
|
|
|
|
|
|
|
|
context "and non reactivated deactivation" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2023, 11, 10)) |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 11, 10)) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 8, 10), reactivation_date: Time.zone.local(2022, 9, 1), location:) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 9, 15), reactivation_date: nil, location:) |
|
|
|
|
Timecop.return |
|
|
|
|
@ -262,7 +262,7 @@ RSpec.describe LocationsHelper do
|
|
|
|
|
context "with out of order deactivations" do |
|
|
|
|
context "and all reactivated deactivations" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2023, 11, 10)) |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 11, 10)) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 9, 24), reactivation_date: Time.zone.local(2022, 9, 28), location:) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 6, 15), reactivation_date: Time.zone.local(2022, 6, 18), location:) |
|
|
|
|
Timecop.return |
|
|
|
|
@ -278,7 +278,7 @@ RSpec.describe LocationsHelper do
|
|
|
|
|
|
|
|
|
|
context "and one non reactivated deactivation" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2023, 11, 10)) |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 11, 10)) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 9, 24), reactivation_date: Time.zone.local(2022, 9, 28), location:) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 6, 15), reactivation_date: nil, location:) |
|
|
|
|
Timecop.return |
|
|
|
|
@ -296,7 +296,7 @@ RSpec.describe LocationsHelper do
|
|
|
|
|
context "with multiple out of order deactivations" do |
|
|
|
|
context "and one non reactivated deactivation" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2023, 11, 10)) |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 11, 10)) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 9, 24), reactivation_date: Time.zone.local(2022, 9, 28), location:) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 10, 24), reactivation_date: Time.zone.local(2022, 10, 28), location:) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 6, 15), reactivation_date: nil, location:) |
|
|
|
|
@ -314,7 +314,7 @@ RSpec.describe LocationsHelper do
|
|
|
|
|
|
|
|
|
|
context "with intersecting deactivations" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2023, 11, 10)) |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 11, 10)) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 10, 10), reactivation_date: Time.zone.local(2022, 12, 1), location:) |
|
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 11, 11), reactivation_date: Time.zone.local(2022, 12, 11), location:) |
|
|
|
|
Timecop.return |
|
|
|
|
|