Browse Source

Action PR comments

pull/3373/head
oscric 4 weeks ago
parent
commit
e1258521bd
  1. 10
      spec/models/lettings_log_derived_fields_spec.rb
  2. 2
      spec/services/csv/lettings_log_csv_service_spec.rb

10
spec/models/lettings_log_derived_fields_spec.rb

@ -1640,7 +1640,7 @@ RSpec.describe LettingsLog, type: :model do
.and(change { log.read_attribute(:postcode_known) }.from(postcode_known).to(nil)) .and(change { log.read_attribute(:postcode_known) }.from(postcode_known).to(nil))
end end
it "does not reset `manual_address_entry_selected`;" do it "does not reset `manual_address_entry_selected`" do
expect { log.set_derived_fields! } expect { log.set_derived_fields! }
.not_to(change { log.read_attribute(:manual_address_entry_selected) }) .not_to(change { log.read_attribute(:manual_address_entry_selected) })
end end
@ -1671,7 +1671,7 @@ RSpec.describe LettingsLog, type: :model do
.and(change { log.read_attribute(:postcode_known) }.from(postcode_known).to(nil)) .and(change { log.read_attribute(:postcode_known) }.from(postcode_known).to(nil))
end end
it "does not reset `manual_address_entry_selected`;" do it "does not reset `manual_address_entry_selected`" do
expect { log.set_derived_fields! } expect { log.set_derived_fields! }
.not_to(change { log.read_attribute(:manual_address_entry_selected) }) .not_to(change { log.read_attribute(:manual_address_entry_selected) })
end end
@ -1701,7 +1701,7 @@ RSpec.describe LettingsLog, type: :model do
context "when a log is changed from a confidential to a non-confidential scheme" do context "when a log is changed from a confidential to a non-confidential scheme" do
# The confidential logic must leave manual_address_entry_selected in a # The confidential logic must leave manual_address_entry_selected in a
# routable state (default false), otherwise neither address page routes after the # routable state (either true or false), otherwise neither address page routes after the
# switch and the address question is never shown again. # switch and the address question is never shown again.
let(:confidential_scheme) { create(:scheme, sensitive: 1) } let(:confidential_scheme) { create(:scheme, sensitive: 1) }
let(:non_confidential_scheme) { create(:scheme, sensitive: 0) } let(:non_confidential_scheme) { create(:scheme, sensitive: 0) }
@ -1709,7 +1709,7 @@ RSpec.describe LettingsLog, type: :model do
let(:non_confidential_location) { create(:location, scheme: non_confidential_scheme) } let(:non_confidential_location) { create(:location, scheme: non_confidential_scheme) }
before do before do
log.assign_attributes(manual_address_entry_selected: false) log.assign_attributes(manual_address_entry_selected: true)
log.scheme = confidential_scheme log.scheme = confidential_scheme
log.location = confidential_location log.location = confidential_location
log.set_derived_fields! log.set_derived_fields!
@ -1721,7 +1721,7 @@ RSpec.describe LettingsLog, type: :model do
it "asks the address question again with a routable value for `manual_address_entry_selected` (i.e., not nil)" do it "asks the address question again with a routable value for `manual_address_entry_selected` (i.e., not nil)" do
expect(log.is_address_asked?).to be true expect(log.is_address_asked?).to be true
expect(log.manual_address_entry_selected).to be false expect(log.manual_address_entry_selected).to be true
end end
end end
end end

2
spec/services/csv/lettings_log_csv_service_spec.rb

@ -211,7 +211,7 @@ RSpec.describe Csv::LettingsLogCsvService do
location:, location:,
startdate: Time.zone.local(2026, 5, 1), startdate: Time.zone.local(2026, 5, 1),
).tap do |confidential_log| ).tap do |confidential_log|
# Simulate a log created before the confidential-address feature that still holds # Simulate a log created before the confidential address feature that still holds
# property address data in the database. # property address data in the database.
confidential_log.update_columns( confidential_log.update_columns(
uprn: "123456789012", uprn: "123456789012",

Loading…
Cancel
Save