Browse Source

feat: add scheme activating soon tests

pull/2061/head
natdeanlewissoftwire 2 years ago
parent
commit
997b1888d1
  1. 18
      spec/models/scheme_spec.rb

18
spec/models/scheme_spec.rb

@ -242,11 +242,18 @@ RSpec.describe Scheme, type: :model do
expect(scheme.status).to eq(:deactivated)
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:)
scheme.save!
expect(scheme.status).to eq(:reactivating_soon)
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
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)
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)
FactoryBot.create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 5, 5), reactivation_date: Time.zone.local(2022, 6, 2), scheme:)
scheme.save!
expect(scheme.status).to eq(:reactivating_soon)
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

Loading…
Cancel
Save