Browse Source

update mapping in Lettings logs

pull/1402/head
Kat 3 years ago
parent
commit
f560a006a3
  1. 12
      app/models/log.rb
  2. 6
      spec/models/sales_log_spec.rb

12
app/models/log.rb

@ -136,12 +136,12 @@ private
end
LA_CHANGES = {
"E07000027" => "E06000063", # Barrow-in-Furness => Cumberland
"E07000030" => "E06000063", # Eden => Cumberland
"E07000031" => "E06000063", # South Lakeland => Cumberland
"E07000026" => "E06000064", # Allerdale => Westmorland and Furness
"E07000028" => "E06000064", # Carlisle => Westmorland and Furness
"E07000029" => "E06000064", # Copeland => Westmorland and Furness
"E07000027" => "E06000064", # Barrow-in-Furness => Westmorland and Furness
"E07000030" => "E06000064", # Eden => Westmorland and Furness
"E07000031" => "E06000064", # South Lakeland => Westmorland and Furness
"E07000026" => "E06000063", # Allerdale => Cumberland
"E07000028" => "E06000063", # Carlisle => Cumberland
"E07000029" => "E06000063", # Copeland => Cumberland
"E07000163" => "E06000065", # Craven => North Yorkshire
"E07000164" => "E06000065", # Hambleton => North Yorkshire
"E07000165" => "E06000065", # Harrogate => North Yorkshire

6
spec/models/sales_log_spec.rb

@ -239,7 +239,7 @@ RSpec.describe SalesLog, type: :model do
before do
WebMock.stub_request(:get, /api.postcodes.io\/postcodes\/CA101AA/)
.to_return(status: 200, body: '{"status":200,"result":{"admin_district":"Cumberland","codes":{"admin_district":"E06000063"}}}', headers: {})
.to_return(status: 200, body: '{"status":200,"result":{"admin_district":"Cumberland","codes":{"admin_district":"E06000064"}}}', headers: {})
Timecop.freeze(2023, 5, 1)
Singleton.__init__(FormHandler)
@ -281,8 +281,8 @@ RSpec.describe SalesLog, type: :model do
it "correctly infers new la" do
record_from_db = ActiveRecord::Base.connection.execute("select la from sales_logs where id=#{address_sales_log_23_24.id}").to_a[0]
expect(address_sales_log_23_24.la).to eq("E06000063")
expect(record_from_db["la"]).to eq("E06000063")
expect(address_sales_log_23_24.la).to eq("E06000064")
expect(record_from_db["la"]).to eq("E06000064")
end
end

Loading…
Cancel
Save