diff --git a/spec/services/merge/merge_organisations_service_spec.rb b/spec/services/merge/merge_organisations_service_spec.rb index 8d9b9ff46..44fce4a1c 100644 --- a/spec/services/merge/merge_organisations_service_spec.rb +++ b/spec/services/merge/merge_organisations_service_spec.rb @@ -221,19 +221,21 @@ RSpec.describe Merge::MergeOrganisationsService do expect(absorbed_scheme.locations.count).to eq(1) absorbed_location = absorbed_scheme.locations.first - expect(absorbed_scheme.startdate).to eq(Time.zone.today + 1.month) - expect(absorbed_location.startdate).to eq(Time.zone.today + 1.month) + expected_date = Time.zone.today + 1.month + expect(absorbed_scheme.startdate).to eq(expected_date.in_time_zone) + expect(absorbed_location.startdate).to eq(expected_date.in_time_zone) end it "deactivates schemes and locations on the merged organisation on the startdate" do merge_organisations_service.call + expected_date = Time.zone.today + 1.month expect(scheme.owning_organisation).to eq(merging_organisation) expect(location.scheme).to eq(scheme) expect(scheme.scheme_deactivation_periods.count).to eq(1) - expect(scheme.scheme_deactivation_periods.first.deactivation_date).to eq(Time.zone.today + 1.month) + expect(scheme.scheme_deactivation_periods.first.deactivation_date).to eq(expected_date.in_time_zone) expect(location.location_deactivation_periods.count).to eq(1) - expect(location.location_deactivation_periods.first.deactivation_date).to eq(Time.zone.today + 1.month) + expect(location.location_deactivation_periods.first.deactivation_date).to eq(expected_date.in_time_zone) end end end @@ -376,15 +378,16 @@ RSpec.describe Merge::MergeOrganisationsService do expect(absorbed_scheme.locations.count).to eq(1) absorbed_location = absorbed_scheme.locations.first + expected_reactivation_date = Time.zone.today + 1.month expect(absorbed_scheme.startdate).to eq(Time.zone.today) expect(absorbed_scheme.scheme_deactivation_periods.count).to eq(1) expect(absorbed_scheme.scheme_deactivation_periods.first.deactivation_date).to eq(Time.zone.today) - expect(absorbed_scheme.scheme_deactivation_periods.first.reactivation_date).to eq(Time.zone.today + 1.month) + expect(absorbed_scheme.scheme_deactivation_periods.first.reactivation_date).to eq(expected_reactivation_date.in_time_zone) expect(absorbed_location.startdate).to eq(Time.zone.today) expect(absorbed_location.location_deactivation_periods.count).to eq(1) expect(absorbed_location.location_deactivation_periods.first.deactivation_date).to eq(Time.zone.today) - expect(absorbed_location.location_deactivation_periods.first.reactivation_date).to eq(Time.zone.today + 1.month) + expect(absorbed_location.location_deactivation_periods.first.reactivation_date).to eq(expected_reactivation_date.in_time_zone) end it "deactivates schemes and locations on the merged organisation" do