|
|
@ -221,19 +221,21 @@ RSpec.describe Merge::MergeOrganisationsService do |
|
|
|
expect(absorbed_scheme.locations.count).to eq(1) |
|
|
|
expect(absorbed_scheme.locations.count).to eq(1) |
|
|
|
absorbed_location = absorbed_scheme.locations.first |
|
|
|
absorbed_location = absorbed_scheme.locations.first |
|
|
|
|
|
|
|
|
|
|
|
expect(absorbed_scheme.startdate).to eq(Time.zone.today + 1.month) |
|
|
|
expected_date = Time.zone.today + 1.month |
|
|
|
expect(absorbed_location.startdate).to eq(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 |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "deactivates schemes and locations on the merged organisation on the startdate" do |
|
|
|
it "deactivates schemes and locations on the merged organisation on the startdate" do |
|
|
|
merge_organisations_service.call |
|
|
|
merge_organisations_service.call |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expected_date = Time.zone.today + 1.month |
|
|
|
expect(scheme.owning_organisation).to eq(merging_organisation) |
|
|
|
expect(scheme.owning_organisation).to eq(merging_organisation) |
|
|
|
expect(location.scheme).to eq(scheme) |
|
|
|
expect(location.scheme).to eq(scheme) |
|
|
|
expect(scheme.scheme_deactivation_periods.count).to eq(1) |
|
|
|
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.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 |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -376,15 +378,16 @@ RSpec.describe Merge::MergeOrganisationsService do |
|
|
|
expect(absorbed_scheme.locations.count).to eq(1) |
|
|
|
expect(absorbed_scheme.locations.count).to eq(1) |
|
|
|
absorbed_location = absorbed_scheme.locations.first |
|
|
|
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.startdate).to eq(Time.zone.today) |
|
|
|
expect(absorbed_scheme.scheme_deactivation_periods.count).to eq(1) |
|
|
|
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.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.startdate).to eq(Time.zone.today) |
|
|
|
expect(absorbed_location.location_deactivation_periods.count).to eq(1) |
|
|
|
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.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 |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "deactivates schemes and locations on the merged organisation" do |
|
|
|
it "deactivates schemes and locations on the merged organisation" do |
|
|
|