text+="#{merge_request.absorbing_organisation.name} users will have access to all #{type} logs owned or managed by the merging organisations after the merge.<br><br>"
text+="#{type.capitalize} logs that are owned or managed by the merging organisations and have a tenancy start date after the merge date will have their owning or managing organisation changed to #{merge_request.absorbing_organisation.name}.<br><br>"
text+="Some logs are owned and managed by different organisations in this merge. They appear in the list for both the owning and the managing organisation.<br><br>"
expect(outcome_text).not_toinclude("Org 1 users will have access to all lettings logs owned or managed by the merging organisations after the merge.")
expect(outcome_text).not_toinclude("Lettings logs that are owned or managed by the merging organisations and have a tenancy start date after the merge date will have their owning or managing organisation changed to Org 1.")
expect(outcome_text).not_toinclude("Some logs are owned and managed by different organisations in this merge. They appear in the list for both the owning and the managing organisation.")
expect(outcome_text).toinclude("Org 1 and Org 2 have no lettings logs.")
expect(outcome_text).not_toinclude("Org 1 users will have access to all sales logs owned or managed by the merging organisations after the merge.")
expect(outcome_text).not_toinclude("Sales logs that are owned or managed by the merging organisations and have a tenancy start date after the merge date will have their owning or managing organisation changed to Org 1.")
expect(outcome_text).not_toinclude("Some logs are owned and managed by different organisations in this merge. They appear in the list for both the owning and the managing organisation.")
expect(outcome_text).toinclude("Org 1 and Org 2 have no sales logs.")
expect(outcome_text).toinclude("Org 1 users will have access to all lettings logs owned or managed by the merging organisations after the merge.")
expect(outcome_text).toinclude("Lettings logs that are owned or managed by the merging organisations and have a tenancy start date after the merge date will have their owning or managing organisation changed to Org 1.")
expect(outcome_text).not_toinclude("Some logs are owned and managed by different organisations in this merge. They appear in the list for both the owning and the managing organisation.")
expect(outcome_text).not_toinclude("Org 2 has no lettings logs.")
expect(outcome_text).toinclude("View all 2 Org 2 lettings logs (opens in a new tab)")
expect(outcome_text).toinclude("Org 1 users will have access to all sales logs owned or managed by the merging organisations after the merge.")
expect(outcome_text).toinclude("Sales logs that are owned or managed by the merging organisations and have a tenancy start date after the merge date will have their owning or managing organisation changed to Org 1.")
expect(outcome_text).not_toinclude("Some logs are owned and managed by different organisations in this merge. They appear in the list for both the owning and the managing organisation.")
expect(outcome_text).not_toinclude("Org 2 has no sales logs.")
expect(outcome_text).toinclude("View all 2 Org 2 sales logs (opens in a new tab)")
expect(outcome_text).toinclude("Org 1 users will have access to all lettings logs owned or managed by the merging organisations after the merge.")
expect(outcome_text).toinclude("Lettings logs that are owned or managed by the merging organisations and have a tenancy start date after the merge date will have their owning or managing organisation changed to Org 1.")
expect(outcome_text).toinclude("Some logs are owned and managed by different organisations in this merge. They appear in the list for both the owning and the managing organisation.")
expect(outcome_text).not_toinclude("Org 2 has no lettings logs.")
expect(outcome_text).toinclude("View all 3 Org 2 lettings logs (opens in a new tab)")
expect(outcome_text).toinclude("View 1 Org 3 lettings log (opens in a new tab)")
expect(outcome_text).toinclude("Org 1 users will have access to all sales logs owned or managed by the merging organisations after the merge.")
expect(outcome_text).toinclude("Sales logs that are owned or managed by the merging organisations and have a tenancy start date after the merge date will have their owning or managing organisation changed to Org 1.")
expect(outcome_text).toinclude("Some logs are owned and managed by different organisations in this merge. They appear in the list for both the owning and the managing organisation.")
expect(outcome_text).not_toinclude("Org 2 has no sales logs.")
expect(outcome_text).toinclude("View all 3 Org 2 sales logs (opens in a new tab)")
expect(outcome_text).toinclude("View 1 Org 3 sales log (opens in a new tab)")
expect(page).tohave_link("View all 4 Organisation with some logs lettings logs (opens in a new tab)",href:lettings_logs_organisation_path(organisation_with_some_logs))
expect(page).tohave_link("View all 2 Organisation with some logs sales logs (opens in a new tab)",href:sales_logs_organisation_path(organisation_with_some_logs))
expect(page).tohave_link("View all 2 MHCLG lettings logs (opens in a new tab)",href:lettings_logs_organisation_path(organisation))
expect(page).tohave_link("View all 3 MHCLG sales logs (opens in a new tab)",href:sales_logs_organisation_path(organisation))
expect(page).tohave_content("Organisation with no logs and Organisation with no logs too have no lettings logs.")
expect(page).tohave_content("Organisation with no logs and Organisation with no logs too have no sales logs.")
expect(page).tohave_content("6 lettings logs after merge")
expect(page).tohave_content("5 sales logs after merge")
end
end
end
context"when user is signed in with a data coordinator user"do