|
|
|
@ -1746,6 +1746,11 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
expect(parser.errors[field]).to be_empty |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not set manual address input" do |
|
|
|
|
parser.valid? |
|
|
|
|
expect(parser.log.manual_address_entry_selected).to be_falsey |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when no address can be found" do |
|
|
|
@ -1754,13 +1759,20 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
.to_return(status: 200, body: { results: [] }.to_json, headers: {}) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "adds address not found errors to address fields only" do |
|
|
|
|
it "does not add errors" do |
|
|
|
|
parser.valid? |
|
|
|
|
expect(parser.errors[:field_16]).to be_empty |
|
|
|
|
%i[field_17 field_18 field_19 field_20 field_21 field_22].each do |field| |
|
|
|
|
expect(parser.errors[field]).to eql([I18n.t("validations.lettings.2024.bulk_upload.address.not_found")]) |
|
|
|
|
%i[field_16 field_17 field_18 field_19 field_20 field_21 field_22].each do |field| |
|
|
|
|
expect(parser.errors[field]).to be_empty |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "sets manual address input" do |
|
|
|
|
parser.valid? |
|
|
|
|
expect(parser.log.manual_address_entry_selected).to be_truthy |
|
|
|
|
expect(parser.log.address_line1).to eq("address line 1") |
|
|
|
|
expect(parser.log.town_or_city).to eq("town or city") |
|
|
|
|
expect(parser.log.postcode_full).to eq("AA1 1AA") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when a single address with not a high enough match rating is returned" do |
|
|
|
@ -1769,13 +1781,20 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
.to_return(status: 200, body: { results: [{ DPA: { MATCH: 0.6, BUILDING_NAME: "", POST_TOWN: "", POSTCODE: "AA1 1AA", UPRN: "1" } }] }.to_json, headers: {}) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "adds address not found errors to address fields only" do |
|
|
|
|
it "does not add errors" do |
|
|
|
|
parser.valid? |
|
|
|
|
expect(parser.errors[:field_16]).to be_empty |
|
|
|
|
%i[field_17 field_18 field_19 field_20 field_21 field_22].each do |field| |
|
|
|
|
expect(parser.errors[field]).to eql([I18n.t("validations.lettings.2024.bulk_upload.address.not_determined.one")]) |
|
|
|
|
%i[field_16 field_17 field_18 field_19 field_20 field_21 field_22].each do |field| |
|
|
|
|
expect(parser.errors[field]).to be_empty |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "sets manual address input" do |
|
|
|
|
parser.valid? |
|
|
|
|
expect(parser.log.manual_address_entry_selected).to be_truthy |
|
|
|
|
expect(parser.log.address_line1).to eq("address line 1") |
|
|
|
|
expect(parser.log.town_or_city).to eq("town or city") |
|
|
|
|
expect(parser.log.postcode_full).to eq("AA1 1AA") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when no addresses have a high enough match rating" do |
|
|
|
@ -1784,12 +1803,20 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
|
|
|
|
|
.to_return(status: 200, body: { results: [{ DPA: { MATCH: 0.6, BUILDING_NAME: "", POST_TOWN: "", POSTCODE: "AA1 1AA", UPRN: "1" } }, { DPA: { MATCH: 0.8, BUILDING_NAME: "", POST_TOWN: "", POSTCODE: "BB2 2BB", UPRN: "2" } }] }.to_json, headers: {}) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "adds address not found errors to address fields only" do |
|
|
|
|
it "does not add errors" do |
|
|
|
|
parser.valid? |
|
|
|
|
expect(parser.errors[:field_16]).to be_empty |
|
|
|
|
%i[field_17 field_18 field_19 field_20 field_21 field_22].each do |field| |
|
|
|
|
expect(parser.errors[field]).to eql([I18n.t("validations.lettings.2024.bulk_upload.address.not_determined.multiple")]) |
|
|
|
|
%i[field_16 field_17 field_18 field_19 field_20 field_21 field_22].each do |field| |
|
|
|
|
expect(parser.errors[field]).to be_empty |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "sets manual address input" do |
|
|
|
|
parser.valid? |
|
|
|
|
expect(parser.log.manual_address_entry_selected).to be_truthy |
|
|
|
|
expect(parser.log.manual_address_entry_selected).to be_truthy |
|
|
|
|
expect(parser.log.address_line1).to eq("address line 1") |
|
|
|
|
expect(parser.log.town_or_city).to eq("town or city") |
|
|
|
|
expect(parser.log.postcode_full).to eq("AA1 1AA") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|