diff --git a/spec/policies/location_policy_spec.rb b/spec/policies/location_policy_spec.rb index efc56978b..87e57edde 100644 --- a/spec/policies/location_policy_spec.rb +++ b/spec/policies/location_policy_spec.rb @@ -44,18 +44,12 @@ RSpec.describe LocationPolicy do context "with deactivated location" do before do - location.location_deactivation_periods << create(:location_deactivation_period, deactivation_date: Time.zone.local(2024, 4, 10), location:) + location.location_deactivation_periods << create(:location_deactivation_period, deactivation_date: Time.zone.today, location:) location.save! - Timecop.freeze(Time.utc(2024, 4, 10)) - log = create(:lettings_log, scheme: location.scheme, location:) - log.startdate = Time.zone.local(2022, 10, 10) + log = build(:lettings_log, scheme: location.scheme, location:, startdate: Time.zone.today - 2.years) log.save!(validate: false) end - after do - Timecop.unfreeze - end - context "and associated logs in editable collection period" do before do create(:lettings_log, scheme: location.scheme, location:) diff --git a/spec/policies/scheme_policy_spec.rb b/spec/policies/scheme_policy_spec.rb index c22be81bb..d1f6e5ee7 100644 --- a/spec/policies/scheme_policy_spec.rb +++ b/spec/policies/scheme_policy_spec.rb @@ -46,21 +46,15 @@ RSpec.describe SchemePolicy do context "with deactivated scheme" do before do - scheme.scheme_deactivation_periods << create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2024, 4, 10), scheme:) + scheme.scheme_deactivation_periods << create(:scheme_deactivation_period, deactivation_date: Time.zone.today, scheme:) scheme.save! - Timecop.freeze(Time.utc(2024, 4, 10)) - log = create(:lettings_log, :sh, owning_organisation: scheme.owning_organisation, scheme:) - log.startdate = Time.zone.local(2022, 10, 10) + log = build(:lettings_log, :sh, owning_organisation: scheme.owning_organisation, scheme:, startdate: Time.zone.today - 2.years) log.save!(validate: false) end - after do - Timecop.unfreeze - end - context "and associated logs in editable collection period" do before do - create(:lettings_log, :sh, owning_organisation: scheme.owning_organisation, scheme:, startdate: Time.zone.local(2024, 4, 9)) + create(:lettings_log, :sh, owning_organisation: scheme.owning_organisation, scheme:, startdate: Time.zone.yesterday) end it "does not allow deleting a scheme as a provider" do diff --git a/spec/policies/user_policy_spec.rb b/spec/policies/user_policy_spec.rb index 22bec7fc9..5c8ccfef4 100644 --- a/spec/policies/user_policy_spec.rb +++ b/spec/policies/user_policy_spec.rb @@ -144,19 +144,14 @@ RSpec.describe UserPolicy do let(:user) { create(:user, active: false) } before do - Timecop.freeze(Time.utc(2024, 4, 10)) - log = create(:lettings_log, owning_organisation: user.organisation, assigned_to: user) - log.startdate = Time.zone.local(2022, 10, 10) + log = build(:lettings_log, owning_organisation: user.organisation, assigned_to: user, startdate: Time.zone.today - 2.years) log.save!(validate: false) end - after do - Timecop.unfreeze - end context "and associated logs in editable collection period" do before do - create(:lettings_log, :sh, owning_organisation: user.organisation, assigned_to: user, startdate: Time.zone.local(2024, 4, 9)) + create(:lettings_log, :sh, owning_organisation: user.organisation, assigned_to: user, startdate: Time.zone.yesterday) end it "does not allow deleting a user as a provider" do