* Update seeds
* Fix linting
* Update dsa bits
* Fix duplicate user/org variable names
* Fix create_list
* Set faker locale for development and review
* Update tests that relied on user factory default name
* Update more tests
* Add additional randomness to log factories
* Also create older logs
* Update tests and log randomness
* Ensure sufficient gap between child and parent ages
* More test fixes
* Specify names for users
* Fix more tests
* Fix lint
* More fixes
* More randomness in organisation generation
* Add some extra organisations
* Create future logs if future form use is enabled
* Update tests that expect fixed default org name
* Update more tests
* Fix typo
* Another tweak
* More test fixes
* More test fixes
* Another fix
* Update more tests
* More fixes
* Only create outright sale logs for relevant years
* Reduce max random age to avoid soft validations
* Don't allow sales logs to use no longer valid relat value
* Include fixed locations
@ -49,7 +49,7 @@ RSpec.describe MergeRequestsController, type: :request do
end
it"shows the correct content"do
expect(page).tohave_content("Which organisations are merging into MHCLG?")
expect(page).tohave_content("Which organisations are merging into #{organisation.name}?")
end
end
end
@ -64,7 +64,7 @@ RSpec.describe MergeRequestsController, type: :request do
it"adds merging organisation to the page"do
merge_request.reload
expect(page).tohave_content("MHCLG")
expect(page).tohave_content(organisation.name)
expect(page).tohave_content("Other Test Org")
expect(page).tohave_link("Remove")
end
@ -657,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
@ -684,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
@ -710,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")}