From a88b5dd831ec7ae349d4add7ed925ccf2374453e Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Thu, 2 Apr 2026 10:57:21 +0100 Subject: [PATCH] CLDC-NONE: Fix failing lettings log test (#3300) --- spec/models/lettings_log_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb index 212249fc8..9f2f7c675 100644 --- a/spec/models/lettings_log_spec.rb +++ b/spec/models/lettings_log_spec.rb @@ -525,7 +525,13 @@ RSpec.describe LettingsLog do end context "with a current year log" do - let(:log) { create(:lettings_log, :completed, :sh, :startdate_today, owning_organisation:, scheme_id: old_scheme.id, location_id: old_location.id) } + let(:log) do + built_log = create(:lettings_log, :completed, :sh, :startdate_today, owning_organisation:, scheme_id: old_scheme.id, location_id: old_location.id, postcode_full: old_location.postcode) + built_log.save! + # changing a location will reset the address details so we must set these again manually + built_log.update!(address_line1: "123 Main St", postcode_full: old_location.postcode, town_or_city: "London") + built_log + end it "clears the location set on the log" do expect { log.update!(scheme: new_scheme) }.to change(log, :location_id).from(old_location.id).to(nil)