"This scheme deactivates on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date."
when:deactivated
"This scheme deactivated on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date."
casescheme.owning_organisation.status
when:active
"This scheme deactivated on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date."
when:merged
"This scheme has been deactivated due to #{scheme.owning_organisation.name} merging into #{scheme.owning_organisation.absorbing_organisation.name} on #{scheme.owning_organisation.merge_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Use the after merge organisation for schemes and locations active after this date."
more_than_year_from_today:"The merge date must not be later than a year from today’s date."
existing_absorbing_organisation:
blank:"You must answer absorbing organisation already active?"
merging_organisation_id:
part_of_another_merge:"Another merge request records %{organisation} as merging into %{absorbing_organisation} on %{merge_date}. Select another organisation or remove this organisation from the other merge request."
notification:
attributes:
title:
@ -370,6 +373,7 @@ en:
during_deactivated_period:"The location is already deactivated during this date, please enter a different date."
merge_request:
organisation_part_of_another_merge:"This organisation is part of another merge - select a different one."
organisation_part_of_another_incomplete_merge:"Another merge request records %{organisation} as merging into %{absorbing_organisation} on %{merge_date}. Select another organisation or remove this organisation from the other merge request."
organisation_not_selected:"Select an organisation from the search list."
expect(page).tohave_content("Another merge request records #{another_organisation.name} as merging into #{other_merge_request.absorbing_organisation&.name} on 4 May 2022. Select another organisation or remove this organisation from the other merge request.")
end
end
context"when the user selects an organisation that is a part of another merge"do
expect(page).tohave_content("The merge date must not be later than a year from today’s date.")
end
end
end
describe"from merging_organisations page"do
@ -623,7 +657,7 @@ RSpec.describe MergeRequestsController, type: :request do
it"shows user outcomes after merge"do
expect(page).tohave_link("View all 4 Organisation with some users users (opens in a new tab)",href:users_organisation_path(organisation_with_some_users))
expect(page).tohave_link("View all 12 Organisation with many users users (opens in a new tab)",href:users_organisation_path(organisation_with_some_more_users))
expect(page).tohave_link("View all 3 MHCLG users (opens in a new tab)",href:users_organisation_path(organisation))
expect(page).tohave_link("View all 3 #{organisation.name} users (opens in a new tab)",href:users_organisation_path(organisation))
expect(page).tohave_content("Organisation with no users and Organisation with no users too have no users.")
expect(page).tohave_content("19 users after merge")
end
@ -650,7 +684,7 @@ RSpec.describe MergeRequestsController, type: :request do
it"shows scheme outcomes after merge"do
expect(page).tohave_link("View all 4 Organisation with some schemes schemes (opens in a new tab)",href:schemes_organisation_path(organisation_with_some_schemes))
expect(page).tohave_link("View all 6 Organisation with many schemes schemes (opens in a new tab)",href:schemes_organisation_path(organisation_with_some_more_schemes))
expect(page).tohave_link("View all 3 MHCLG schemes (opens in a new tab)",href:schemes_organisation_path(organisation))
expect(page).tohave_link("View all 3 #{organisation.name} schemes (opens in a new tab)",href:schemes_organisation_path(organisation))
expect(page).tohave_content("Organisation with no schemes and Organisation with no schemes too have no schemes.")
expect(page).tohave_content("13 schemes after merge")
end
@ -676,8 +710,8 @@ RSpec.describe MergeRequestsController, type: :request do
it"shows logs outcomes after merge"do
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_link("View all 2 #{organisation.name} lettings logs (opens in a new tab)",href:lettings_logs_organisation_path(organisation))
expect(page).tohave_link("View all 3 #{organisation.name} 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")
@ -1439,7 +1439,7 @@ RSpec.describe OrganisationsController, type: :request do
end
context"when our search string matches case"do
let(:search_param){"joe"}
let(:search_param){"abcdefghijklmnopqrstuvwxyz"}
it"returns only matching results"do
expect(page).tohave_content(matching_user.name)
@ -1459,7 +1459,7 @@ RSpec.describe OrganisationsController, type: :request do
end
context"when we need case insensitive search"do
let(:search_param){"Joe"}
let(:search_param){"Abcdefghijklmnopqrstuvwxyz"}
it"returns only matching results"do
expect(page).tohave_content(matching_user.name)
@ -1643,6 +1643,11 @@ RSpec.describe OrganisationsController, type: :request do
context"when search results require pagination"do
let(:search_param){"MHCLG"}
beforedo
create_list(:organisation,27,name:"MHCLG")
get"/organisations?search=#{search_param}"
end
it"has search and pagination in the title"do
expect(page).tohave_title("Organisations (27 organisations matching ‘#{search_param}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).tohave_content("New org must be a managing agent of #{other_user.organisation_name}, #{new_organisation_2.name}, and #{new_organisation_3.name} to make this change.")
expect(page).tohave_content("New org must be a managing agent of #{other_user.organisation.name}, #{new_organisation_2.name}, and #{new_organisation_3.name} to make this change.")
@ -429,7 +430,7 @@ RSpec.describe Exports::LettingsLogExportService do
end
context"and one lettings log is available for export"do
let!(:lettings_log){FactoryBot.create(:lettings_log,:completed,assigned_to:user,ppostcode_full:"A1 1AA",nationality_all_group:13,propcode:"123",postcode_full:"SE2 6RT",tenancycode:"BZ737",startdate:Time.zone.local(2024,4,2,10,36,49),voiddate:Time.zone.local(2021,11,3),mrcdate:Time.zone.local(2022,5,5,10,36,49),tenancylength:5,underoccupation_benefitcap:4,creation_method:2,bulk_upload_id:1,address_line1_as_entered:"address line 1 as entered",address_line2_as_entered:"address line 2 as entered",town_or_city_as_entered:"town or city as entered",county_as_entered:"county as entered",postcode_full_as_entered:"AB1 2CD",la_as_entered:"la as entered")}
let!(:lettings_log){FactoryBot.create(:lettings_log,:completed,assigned_to:user,age1:35,sex1:"F",age2:32,sex2:"M",ppostcode_full:"A1 1AA",nationality_all_group:13,propcode:"123",postcode_full:"SE2 6RT",tenancycode:"BZ737",startdate:Time.zone.local(2024,4,2,10,36,49),voiddate:Time.zone.local(2021,11,3),mrcdate:Time.zone.local(2022,5,5,10,36,49),tenancylength:5,underoccupation_benefitcap:4,creation_method:2,bulk_upload_id:1,address_line1_as_entered:"address line 1 as entered",address_line2_as_entered:"address line 2 as entered",town_or_city_as_entered:"town or city as entered",county_as_entered:"county as entered",postcode_full_as_entered:"AB1 2CD",la_as_entered:"la as entered")}