|
|
@ -381,14 +381,11 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the organisation has absorbed other organisations" do |
|
|
|
context "when the organisation has absorbed other organisations" do |
|
|
|
let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation") } |
|
|
|
let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } |
|
|
|
let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation") } |
|
|
|
let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } |
|
|
|
let!(:previously_absorbed_organisation) { create(:organisation, name: "Previously Absorbed Organisation") } |
|
|
|
let!(:previously_absorbed_organisation) { create(:organisation, name: "Previously Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 2), absorbing_organisation: organisation) } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) |
|
|
|
|
|
|
|
other_absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) |
|
|
|
|
|
|
|
previously_absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 2), absorbing_organisation: organisation) |
|
|
|
|
|
|
|
get "/organisations/#{organisation.id}/details", headers:, params: {} |
|
|
|
get "/organisations/#{organisation.id}/details", headers:, params: {} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -406,12 +403,23 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the organisation has absorbed other organisations during a closed collection period" do |
|
|
|
context "when the organisation has absorbed other organisations during a closed collection period" do |
|
|
|
let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation") } |
|
|
|
before do |
|
|
|
let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation") } |
|
|
|
create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 2.years, absorbing_organisation: organisation) |
|
|
|
|
|
|
|
create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 2.years, absorbing_organisation: organisation) |
|
|
|
|
|
|
|
get "/organisations/#{organisation.id}/details", headers:, params: {} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "displays absorbed organisations" do |
|
|
|
|
|
|
|
expect(page).to have_content("View all organisations that were merged into #{organisation.name}") |
|
|
|
|
|
|
|
expect(page).to have_content("First Absorbed Organisation") |
|
|
|
|
|
|
|
expect(page).to have_content("Other Absorbed Organisation") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when the organisation has absorbed other organisations during a collection period before archived" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
absorbed_organisation.update!(merge_date: Time.zone.local(2021, 4, 3), absorbing_organisation: organisation) |
|
|
|
create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 3.years, absorbing_organisation: organisation) |
|
|
|
other_absorbed_organisation.update!(merge_date: Time.zone.local(2021, 4, 3), absorbing_organisation: organisation) |
|
|
|
create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.today - 3.years, absorbing_organisation: organisation) |
|
|
|
get "/organisations/#{organisation.id}/details", headers:, params: {} |
|
|
|
get "/organisations/#{organisation.id}/details", headers:, params: {} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -424,12 +432,10 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the organisation has absorbed other organisations without merge dates" do |
|
|
|
context "when the organisation has absorbed other organisations without merge dates" do |
|
|
|
let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation") } |
|
|
|
let!(:absorbed_organisation) { create(:organisation, name: "First Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } |
|
|
|
let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation") } |
|
|
|
let!(:other_absorbed_organisation) { create(:organisation, name: "Other Absorbed Organisation", with_dsa: false, merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) |
|
|
|
|
|
|
|
other_absorbed_organisation.update!(merge_date: Time.zone.local(2023, 4, 3), absorbing_organisation: organisation) |
|
|
|
|
|
|
|
get "/organisations/#{organisation.id}/details", headers:, params: {} |
|
|
|
get "/organisations/#{organisation.id}/details", headers:, params: {} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|