|
|
|
@ -1867,7 +1867,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#uprn" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_16: "12" } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_16: "12" } } |
|
|
|
|
|
|
|
|
|
it "sets to given value" do |
|
|
|
|
expect(parser.log.uprn).to eql("12") |
|
|
|
@ -1876,7 +1876,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
|
|
|
|
|
describe "#uprn_known" do |
|
|
|
|
context "when uprn specified" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_16: "12" } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_16: "12" } } |
|
|
|
|
|
|
|
|
|
it "sets to 1" do |
|
|
|
|
expect(parser.log.uprn_known).to be(1) |
|
|
|
@ -1885,7 +1885,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when uprn blank" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_16: "", field_4: 1 } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_16: "" } } |
|
|
|
|
|
|
|
|
|
it "sets to 0" do |
|
|
|
|
expect(parser.log.uprn_known).to be(0) |
|
|
|
@ -1894,7 +1894,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#address_line1" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_17: "123 Sesame Street" } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_17: "123 Sesame Street" } } |
|
|
|
|
|
|
|
|
|
it "sets to given value" do |
|
|
|
|
expect(parser.log.address_line1).to eql("123 Sesame Street") |
|
|
|
@ -1902,7 +1902,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#address_line2" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_18: "Cookie Town" } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_18: "Cookie Town" } } |
|
|
|
|
|
|
|
|
|
it "sets to given value" do |
|
|
|
|
expect(parser.log.address_line2).to eql("Cookie Town") |
|
|
|
@ -1910,7 +1910,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#town_or_city" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_19: "London" } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_19: "London" } } |
|
|
|
|
|
|
|
|
|
it "sets to given value" do |
|
|
|
|
expect(parser.log.town_or_city).to eql("London") |
|
|
|
@ -1918,13 +1918,39 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#county" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_20: "Greater London" } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_20: "Greater London" } } |
|
|
|
|
|
|
|
|
|
it "sets to given value" do |
|
|
|
|
expect(parser.log.county).to eql("Greater London") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "address related fields for supported housing logs" do |
|
|
|
|
context "when address data is provided for a supported housing log" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 2, field_16: nil, field_17: "Flat 1", field_18: "Example Place", field_19: "London", field_20: "Greater London", field_21: "SW1A", field_22: "1AA" } } |
|
|
|
|
|
|
|
|
|
it "is not set on the log" do |
|
|
|
|
expect(parser.log.uprn).to be_nil |
|
|
|
|
expect(parser.log.uprn_known).to be_nil |
|
|
|
|
expect(parser.log.address_line1).to be_nil |
|
|
|
|
expect(parser.log.address_line1_as_entered).to be_nil |
|
|
|
|
expect(parser.log.address_line2).to be_nil |
|
|
|
|
expect(parser.log.address_line2_as_entered).to be_nil |
|
|
|
|
expect(parser.log.town_or_city).to be_nil |
|
|
|
|
expect(parser.log.town_or_city_as_entered).to be_nil |
|
|
|
|
expect(parser.log.county).to be_nil |
|
|
|
|
expect(parser.log.county_as_entered).to be_nil |
|
|
|
|
expect(parser.log.postcode_full).to be_nil |
|
|
|
|
expect(parser.log.postcode_full_as_entered).to be_nil |
|
|
|
|
expect(parser.log.la).to be_nil |
|
|
|
|
expect(parser.log.la_as_entered).to be_nil |
|
|
|
|
expect(parser.log.address_line1_input).to be_nil |
|
|
|
|
expect(parser.log.postcode_full_input).to be_nil |
|
|
|
|
expect(parser.log.select_best_address_match).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
[ |
|
|
|
|
%w[age1_known details_known_1 age1 field_42 field_47 field_49], |
|
|
|
|
%w[age2_known details_known_2 age2 field_48 field_47 field_49], |
|
|
|
@ -2611,7 +2637,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#postcode_full" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_21: " EC1N ", field_22: " 2TD " } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_21: " EC1N ", field_22: " 2TD " } } |
|
|
|
|
|
|
|
|
|
it "strips whitespace" do |
|
|
|
|
expect(parser.log.postcode_full).to eql("EC1N 2TD") |
|
|
|
@ -2619,7 +2645,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#la" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_23: "E07000223" } } |
|
|
|
|
let(:attributes) { { bulk_upload:, field_4: 1, field_23: "E07000223" } } |
|
|
|
|
|
|
|
|
|
it "sets to given value" do |
|
|
|
|
expect(parser.log.la).to eql("E07000223") |
|
|
|
|