|
|
|
@ -242,11 +242,18 @@ RSpec.describe Scheme, type: :model do |
|
|
|
expect(scheme.status).to eq(:deactivated) |
|
|
|
expect(scheme.status).to eq(:deactivated) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "returns reactivating soon if the location has a future reactivation date" do |
|
|
|
it "returns reactivating soon if the scheme has a future reactivation date" do |
|
|
|
FactoryBot.create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 6, 7), reactivation_date: Time.zone.local(2022, 6, 8), scheme:) |
|
|
|
FactoryBot.create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 6, 7), reactivation_date: Time.zone.local(2022, 6, 8), scheme:) |
|
|
|
scheme.save! |
|
|
|
scheme.save! |
|
|
|
expect(scheme.status).to eq(:reactivating_soon) |
|
|
|
expect(scheme.status).to eq(:reactivating_soon) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns activating soon if the scheme has a future startdate" do |
|
|
|
|
|
|
|
Timecop.freeze(2022, 6, 4) |
|
|
|
|
|
|
|
scheme.startdate = Time.zone.local(2022, 7, 7) |
|
|
|
|
|
|
|
scheme.save! |
|
|
|
|
|
|
|
expect(scheme.status).to eq(:activating_soon) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when there have been previous deactivations" do |
|
|
|
context "when there have been previous deactivations" do |
|
|
|
@ -283,12 +290,19 @@ RSpec.describe Scheme, type: :model do |
|
|
|
expect(scheme.status).to eq(:reactivating_soon) |
|
|
|
expect(scheme.status).to eq(:reactivating_soon) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "returns if the scheme had a deactivation during another deactivation" do |
|
|
|
it "returns reactivating soon if the scheme had a deactivation during another deactivation" do |
|
|
|
Timecop.freeze(2022, 6, 4) |
|
|
|
Timecop.freeze(2022, 6, 4) |
|
|
|
FactoryBot.create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 5, 5), reactivation_date: Time.zone.local(2022, 6, 2), scheme:) |
|
|
|
FactoryBot.create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 5, 5), reactivation_date: Time.zone.local(2022, 6, 2), scheme:) |
|
|
|
scheme.save! |
|
|
|
scheme.save! |
|
|
|
expect(scheme.status).to eq(:reactivating_soon) |
|
|
|
expect(scheme.status).to eq(:reactivating_soon) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns activating soon if the scheme has a future startdate" do |
|
|
|
|
|
|
|
Timecop.freeze(2022, 6, 4) |
|
|
|
|
|
|
|
scheme.startdate = Time.zone.local(2022, 7, 7) |
|
|
|
|
|
|
|
scheme.save! |
|
|
|
|
|
|
|
expect(scheme.status).to eq(:activating_soon) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|