|
|
|
@ -151,6 +151,12 @@ RSpec.describe Location, type: :model do |
|
|
|
location.save! |
|
|
|
location.save! |
|
|
|
expect(location.status).to eq(:reactivating_soon) |
|
|
|
expect(location.status).to eq(:reactivating_soon) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns activating soon if the location has a future startdate" do |
|
|
|
|
|
|
|
location.startdate = Time.zone.local(2022, 7, 7) |
|
|
|
|
|
|
|
location.save! |
|
|
|
|
|
|
|
expect(location.status).to eq(:activating_soon) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when there have been previous deactivations" do |
|
|
|
context "when there have been previous deactivations" do |
|
|
|
@ -188,12 +194,18 @@ RSpec.describe Location, type: :model do |
|
|
|
expect(location.status).to eq(:reactivating_soon) |
|
|
|
expect(location.status).to eq(:reactivating_soon) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "returns if the location had a deactivation during another deactivation" do |
|
|
|
it "returns reactivating soon if the location had a deactivation during another deactivation" do |
|
|
|
Timecop.freeze(2022, 6, 4) |
|
|
|
Timecop.freeze(2022, 6, 4) |
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 5, 5), reactivation_date: Time.zone.local(2022, 6, 2), location:) |
|
|
|
FactoryBot.create(:location_deactivation_period, deactivation_date: Time.zone.local(2022, 5, 5), reactivation_date: Time.zone.local(2022, 6, 2), location:) |
|
|
|
location.save! |
|
|
|
location.save! |
|
|
|
expect(location.status).to eq(:reactivating_soon) |
|
|
|
expect(location.status).to eq(:reactivating_soon) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns activating soon if the location has a future startdate" do |
|
|
|
|
|
|
|
location.startdate = Time.zone.local(2022, 7, 7) |
|
|
|
|
|
|
|
location.save! |
|
|
|
|
|
|
|
expect(location.status).to eq(:activating_soon) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|