From 14553ea07d970d6ba3b8347bc071017b27e377b1 Mon Sep 17 00:00:00 2001 From: samyou-softwire Date: Thu, 30 Apr 2026 14:16:34 +0100 Subject: [PATCH] CLDC-4402: update schemes and locations from csv spec --- spec/factories/lettings_log.rb | 1 + ...ate_schemes_and_locations_from_csv_spec.rb | 59 ++----------------- 2 files changed, 7 insertions(+), 53 deletions(-) diff --git a/spec/factories/lettings_log.rb b/spec/factories/lettings_log.rb index 38f066bda..6c44b87ce 100644 --- a/spec/factories/lettings_log.rb +++ b/spec/factories/lettings_log.rb @@ -178,6 +178,7 @@ FactoryBot.define do town_or_city { Faker::Address.city } ppcodenk { 1 } tshortfall_known { 1 } + nationality_all_group { 826 } after(:build) do |log, evaluator| if log.startdate >= Time.zone.local(2024, 4, 1) log.nationality_all_group = 826 diff --git a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb index deef814f6..5a0e382e0 100644 --- a/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb +++ b/spec/lib/tasks/update_schemes_and_locations_from_csv_spec.rb @@ -581,6 +581,12 @@ RSpec.describe "bulk_update" do allow(storage_service).to receive(:get_file_io) .with("updated_locations.csv") .and_return(StringIO.new(replace_entity_ids_for_locations(locations[0], locations[1], locations[2], scheme, scheme, { id: "non existent scheme id" }, File.open("./spec/fixtures/files/updated_locations.csv").read))) + lettings_log.address_line1 = "1 Test Street" + lettings_log.address_line2 = "Testville" + lettings_log.county = "Testshire" + lettings_log.town_or_city = "Testford" + lettings_log.postcode_full = "SW1 1AA" + lettings_log.save!(validate: false) end it "does not clear the charges values and marks the log in progress" do @@ -595,59 +601,6 @@ RSpec.describe "bulk_update" do expect(lettings_log.supcharg).to eq(50) end end - - context "when new LA triggers soft rent ranges validations for closed collection period" do - let!(:lettings_log) do - FactoryBot.create(:lettings_log, - :completed, - :sh, - location: locations[0], - scheme:, - values_updated_at: nil, - owning_organisation: scheme.owning_organisation, - brent: 100, - scharge: 50, - pscharge: 50, - supcharg: 50, - beds: 4, - lettype: 1, - period: 1) - end - - before do - LaRentRange.create!( - ranges_rent_id: "1", - la: "E09000033", - beds: 0, - lettype: 8, - soft_min: 12.41, - soft_max: 89.54, - hard_min: 9.87, - hard_max: 100.99, - start_year: 2022, - ) - - allow(storage_service).to receive(:get_file_io) - .with("updated_locations.csv") - .and_return(StringIO.new(replace_entity_ids_for_locations(locations[0], locations[1], locations[2], scheme, scheme, { id: "non existent scheme id" }, File.open("./spec/fixtures/files/updated_locations.csv").read))) - - lettings_log.startdate = Time.zone.local(2022, 4, 1) - lettings_log.owning_organisation = scheme.owning_organisation - lettings_log.save!(validate: false) - end - - it "does not clear the charges values and confirms the rent value check" do - expect(lettings_log.status).to eq("completed") - task.invoke(original_locations_csv_path, updated_locations_csv_path) - lettings_log.reload - expect(lettings_log.status).to eq("completed") - expect(lettings_log.rent_value_check).to eq(0) - expect(lettings_log.brent).to eq(100) - expect(lettings_log.scharge).to eq(50) - expect(lettings_log.pscharge).to eq(50) - expect(lettings_log.supcharg).to eq(50) - end - end end end end