From 997b1888d1e362c6561ee0da6d0033e1306d285b Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Tue, 5 Dec 2023 14:11:37 +0000 Subject: [PATCH] feat: add scheme activating soon tests --- spec/models/scheme_spec.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/spec/models/scheme_spec.rb b/spec/models/scheme_spec.rb index cb9d74578..af45a182b 100644 --- a/spec/models/scheme_spec.rb +++ b/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