Browse Source

Update tests

pull/2674/head
Manny Dinssa 2 years ago
parent
commit
f3c9371d62
  1. 4
      spec/services/bulk_upload/lettings/validator_spec.rb
  2. 52
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
  3. 54
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb
  4. 2
      spec/services/bulk_upload/sales/validator_spec.rb
  5. 6
      spec/services/bulk_upload/sales/year2023/row_parser_spec.rb
  6. 34
      spec/services/bulk_upload/sales/year2024/row_parser_spec.rb
  7. 6
      spec/services/uprn_client_spec.rb

4
spec/services/bulk_upload/lettings/validator_spec.rb

@ -118,7 +118,7 @@ RSpec.describe BulkUpload::Lettings::Validator do
error = BulkUploadError.find_by(row: "2", field: "field_8", category: "setup")
expect(error.field).to eql("field_8")
expect(error.error).to eql("You must answer tenancy start date (day)")
expect(error.error).to eql("You must answer tenancy start date (day).")
expect(error.tenant_code).to eql(log.tenancycode)
expect(error.property_ref).to eql(log.propcode)
expect(error.row).to eql("2")
@ -161,7 +161,7 @@ RSpec.describe BulkUpload::Lettings::Validator do
error = BulkUploadError.find_by(field: "field_4")
expect(error.field).to eql("field_4")
expect(error.error).to eql("You must answer needs type")
expect(error.error).to eql("You must answer needs type.")
expect(error.tenant_code).to eql(log.tenancycode)
expect(error.property_ref).to eql(log.propcode)
expect(error.row).to eql("2")

52
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -697,8 +697,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "fetches the question's check_answer_label if it exists" do
parser.valid?
expect(parser.errors[:field_19]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_21]).to eql(["You must answer town or city"])
expect(parser.errors[:field_19]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_21]).to eql(["You must answer town or city."])
end
end
end
@ -846,7 +846,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_5]).to be_present
expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type"])
expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type."])
end
end
@ -857,7 +857,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_5]).to be_present
expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type"])
expect(parser.errors[:field_11]).to eq(["You must answer intermediate rent type."])
end
end
@ -868,7 +868,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_5]).to be_present
expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting"])
expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting."])
end
end
@ -879,7 +879,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_5]).to be_present
expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting"])
expect(parser.errors[:field_10]).to eq(["You must answer is this a London Affordable Rent letting."])
end
end
@ -888,7 +888,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "adds error on field_12" do
parser.valid?
expect(parser.errors[:field_12]).to eq(["You must answer product name"])
expect(parser.errors[:field_12]).to eq(["You must answer product name."])
end
end
@ -951,7 +951,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_15]).to be_blank
expect(parser.errors[:field_16]).to eq(["You must answer scheme code"])
expect(parser.errors[:field_16]).to eq(["You must answer scheme code."])
expect(parser.errors[:field_17]).to be_blank
end
end
@ -992,7 +992,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
expect(parser.errors[:field_15]).to be_blank
expect(parser.errors[:field_16]).to be_blank
expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["You must answer location code"])
expect(parser.errors.where(:field_17, category: :setup).map(&:message)).to eq(["You must answer location code."])
expect(parser.errors[:field_17].count).to eq(1)
end
end
@ -1005,7 +1005,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
expect(parser.errors[:field_16]).to be_blank
expect(parser.errors[:field_17]).to be_blank
expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["You must answer management group code"])
expect(parser.errors.where(:field_15, category: :setup).map(&:message)).to eq(["You must answer management group code."])
expect(parser.errors[:field_15].count).to eq(1)
end
end
@ -1093,7 +1093,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_15]).to be_blank
expect(parser.errors[:field_16]).to include("You must answer scheme name")
expect(parser.errors[:field_16]).to include("You must answer scheme name.")
expect(parser.errors[:field_17]).to be_blank
end
end
@ -1135,7 +1135,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
parser.valid?
expect(parser.errors[:field_15]).to be_blank
expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["You must answer scheme code"])
expect(parser.errors.where(:field_16, category: :setup).map(&:message)).to eq(["You must answer scheme code."])
expect(parser.errors[:field_17]).to be_blank
end
end
@ -1212,7 +1212,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "clears the scheme answer" do
parser.valid?
expect(parser.errors[:field_15]).to include("You must answer scheme name")
expect(parser.errors[:field_15]).to include("You must answer scheme name.")
expect(parser.errors[:field_16]).to be_blank
expect(parser.errors[:field_17]).to be_blank
end
@ -1255,7 +1255,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "returns an error" do
parser.valid?
expect(parser.errors[:field_102]).to include("Enter a valid value for What is the tenant’s main reason for the household leaving their last settled home?")
expect(parser.errors[:field_102]).to include("Enter a valid value for what is the tenant’s main reason for the household leaving their last settled home?")
end
end
end
@ -1527,7 +1527,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "is not permitted as setup error" do
parser.valid?
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation"])
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."])
end
it "blocks log creation" do
@ -1692,7 +1692,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "is reported as a setup error" do
parser.valid?
expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql(["You must answer needs type"])
expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql(["You must answer needs type."])
end
end
end
@ -1703,7 +1703,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "has setup errors on the field" do
parser.valid?
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eql(["You must answer property renewal"])
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eql(["You must answer property renewal."])
end
end
@ -1712,7 +1712,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "adds a setup error" do
parser.valid?
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include("Enter a valid value for Is this letting a renewal?")
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to include("Enter a valid value for is this letting a renewal?")
end
end
end
@ -1723,7 +1723,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "adds an appropriate error" do
parser.valid?
expect(parser.errors[:field_18]).to eql(["UPRN is not recognised. Check the number, or enter the address"])
expect(parser.errors[:field_18]).to eql(["UPRN is not recognised. Check the number, or enter the address."])
end
end
@ -1733,9 +1733,9 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "adds appropriate errors" do
parser.valid?
expect(parser.errors[:field_18]).to eql(["You must answer UPRN"])
expect(parser.errors[:field_19]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_21]).to eql(["You must answer town or city"])
expect(parser.errors[:field_18]).to eql(["You must answer UPRN."])
expect(parser.errors[:field_19]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_21]).to eql(["You must answer town or city."])
end
end
@ -1811,7 +1811,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "populates with correct error message" do
parser.valid?
expect(parser.errors[:field_30]).to eql(["You must answer type of building"])
expect(parser.errors[:field_30]).to eql(["You must answer type of building."])
end
end
end
@ -2160,7 +2160,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "adds an error" do
parser.valid?
expect(parser.errors[:field_116]).to include("Enter a valid value for was the letting made under the Choice-Based Lettings (CBL)")
expect(parser.errors[:field_116]).to include("Enter a valid value for was the letting made under the Choice-Based Lettings (CBL)?")
end
end
end
@ -2187,7 +2187,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "adds an error" do
parser.valid?
expect(parser.errors[:field_118]).to include("Enter a valid value for was the letting made under the Common Housing Register (CHR)")
expect(parser.errors[:field_118]).to include("Enter a valid value for was the letting made under the Common Housing Register (CHR)?")
end
end
end
@ -2214,7 +2214,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
it "adds an error" do
parser.valid?
expect(parser.errors[:field_117]).to include("Enter a valid value for was the letting made under the Common Allocation Policy (CAP)")
expect(parser.errors[:field_117]).to include("Enter a valid value for was the letting made under the Common Allocation Policy (CAP)?")
end
end
end

54
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -770,7 +770,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "fetches the question's check_answer_label if it exists" do
parser.valid?
expect(parser.errors[:field_43]).to eql(["You must answer lead tenant’s gender identity"])
expect(parser.errors[:field_43]).to eql(["You must answer lead tenant’s gender identity."])
end
end
@ -905,8 +905,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "cannot be nulled" do
parser.valid?
expect(parser.errors[:field_5]).to eq(["You must answer scheme code"])
expect(parser.errors[:field_6]).to eq(["You must answer location code"])
expect(parser.errors[:field_5]).to eq(["You must answer scheme code."])
expect(parser.errors[:field_6]).to eq(["You must answer location code."])
end
end
@ -942,7 +942,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "returns a setup error" do
expect(parser.errors[:field_5]).to be_blank
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["You must answer location code"])
expect(parser.errors.where(:field_6, category: :setup).map(&:message)).to eq(["You must answer location code."])
expect(parser.errors[:field_6].count).to eq(1)
end
end
@ -1011,7 +1011,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
let(:attributes) { { bulk_upload:, field_4: "2", field_11: "2", field_5: "S#{managing_org_scheme.id}", field_6: managing_org_location.id, field_2: managing_org.old_visible_id } }
it "clears the scheme answer" do
expect(parser.errors[:field_5]).to include("You must answer scheme name")
expect(parser.errors[:field_5]).to include("You must answer scheme name.")
expect(parser.errors[:field_6]).to be_blank
end
end
@ -1081,7 +1081,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "returns an error" do
parser.valid?
expect(parser.errors[:field_98]).to include("Enter a valid value for What is the tenant’s main reason for the household leaving their last settled home?")
expect(parser.errors[:field_98]).to include("Enter a valid value for what is the tenant’s main reason for the household leaving their last settled home?")
end
end
end
@ -1348,7 +1348,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "is not permitted as setup error" do
parser.valid?
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation"])
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."])
end
it "blocks log creation" do
@ -1504,7 +1504,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
setup_errors = parser.errors.select { |e| e.options[:category] == :setup }
expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer managing organisation")
expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer managing organisation.")
end
it "blocks log creation" do
@ -1556,7 +1556,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "is reported as a setup error" do
parser.valid?
expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql(["You must answer needs type"])
expect(parser.errors.where(:field_4, category: :setup).map(&:message)).to eql(["You must answer needs type."])
end
end
end
@ -1567,7 +1567,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "has setup errors on the field" do
parser.valid?
expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to eql(["You must answer property renewal"])
expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to eql(["You must answer property renewal."])
end
end
@ -1576,7 +1576,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds a setup error" do
parser.valid?
expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to include("Enter a valid value for Is this letting a renewal?")
expect(parser.errors.where(:field_7, category: :setup).map(&:message)).to include("Enter a valid value for is this letting a renewal?")
end
end
end
@ -1607,10 +1607,10 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds errors to missing key address fields" do
parser.valid?
expect(parser.errors[:field_17]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_19]).to eql(["You must answer town or city"])
expect(parser.errors[:field_21]).to eql(["You must answer part 1 of postcode"])
expect(parser.errors[:field_22]).to eql(["You must answer part 2 of postcode"])
expect(parser.errors[:field_17]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_19]).to eql(["You must answer town or city."])
expect(parser.errors[:field_21]).to eql(["You must answer part 1 of postcode."])
expect(parser.errors[:field_22]).to eql(["You must answer part 2 of postcode."])
end
end
@ -1638,11 +1638,11 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds appropriate errors to UPRN and key address fields" do
parser.valid?
expect(parser.errors[:field_16]).to eql(["You must answer UPRN"])
expect(parser.errors[:field_17]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_19]).to eql(["You must answer town or city"])
expect(parser.errors[:field_21]).to eql(["You must answer part 1 of postcode"])
expect(parser.errors[:field_22]).to eql(["You must answer part 2 of postcode"])
expect(parser.errors[:field_16]).to eql(["You must answer UPRN."])
expect(parser.errors[:field_17]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_19]).to eql(["You must answer town or city."])
expect(parser.errors[:field_21]).to eql(["You must answer part 1 of postcode."])
expect(parser.errors[:field_22]).to eql(["You must answer part 2 of postcode."])
end
end
@ -1651,8 +1651,8 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds errors to UPRN and the missing key address field" do
parser.valid?
expect(parser.errors[:field_16]).to eql(["You must answer UPRN"])
expect(parser.errors[:field_17]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_16]).to eql(["You must answer UPRN."])
expect(parser.errors[:field_17]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_19]).to be_empty
expect(parser.errors[:field_21]).to be_empty
expect(parser.errors[:field_22]).to be_empty
@ -1745,7 +1745,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "populates with correct error message" do
parser.valid?
expect(parser.errors[:field_27]).to eql(["You must answer type of building"])
expect(parser.errors[:field_27]).to eql(["You must answer type of building."])
end
end
end
@ -2165,7 +2165,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds an error" do
parser.valid?
expect(parser.errors[:field_112]).to include("Enter a valid value for was the letting made under the Choice-Based Lettings (CBL)")
expect(parser.errors[:field_112]).to include("Enter a valid value for was the letting made under the Choice-Based Lettings (CBL)?")
end
end
end
@ -2192,7 +2192,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds an error" do
parser.valid?
expect(parser.errors[:field_114]).to include("Enter a valid value for was the letting made under the Common Housing Register (CHR)")
expect(parser.errors[:field_114]).to include("Enter a valid value for was the letting made under the Common Housing Register (CHR)?")
end
end
end
@ -2219,7 +2219,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds an error" do
parser.valid?
expect(parser.errors[:field_113]).to include("Enter a valid value for was the letting made under the Common Allocation Policy (CAP)")
expect(parser.errors[:field_113]).to include("Enter a valid value for was the letting made under the Common Allocation Policy (CAP)?")
end
end
end
@ -2246,7 +2246,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
it "adds an error" do
parser.valid?
expect(parser.errors[:field_115]).to include("Enter a valid value for was the letting made under the Accessible Register")
expect(parser.errors[:field_115]).to include("Enter a valid value for was the letting made under the Accessible Register?")
end
end
end

2
spec/services/bulk_upload/sales/validator_spec.rb

@ -137,7 +137,7 @@ RSpec.describe BulkUpload::Sales::Validator do
error = BulkUploadError.find_by(row: "2", field: "field_1", category: "setup")
expect(error.field).to eql("field_1")
expect(error.error).to eql("You must answer owning organisation")
expect(error.error).to eql("You must answer owning organisation.")
expect(error.purchaser_code).to eql(log.purchaser_code)
expect(error.row).to eql("2")
expect(error.cell).to eql("B2")

6
spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

@ -406,7 +406,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
let(:attributes) { setup_section_params.merge(field_1: nil) }
it "is not permitted as setup error" do
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation"])
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."])
end
it "blocks log creation" do
@ -418,7 +418,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
let(:attributes) { { bulk_upload:, field_1: "donotexist" } }
it "is not permitted as a setup error" do
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation"])
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."])
end
it "blocks log creation" do
@ -1041,7 +1041,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
let(:attributes) { setup_section_params.merge(field_105: "4") }
it "returns correct errors" do
expect(parser.errors[:field_105]).to include("Enter a valid value for Was a mortgage used for the purchase of this property? - Shared ownership")
expect(parser.errors[:field_105]).to include("Enter a valid value for was a mortgage used for the purchase of this property? - Shared ownership.")
parser.log.blank_invalid_non_setup_fields!
parser.log.save!
expect(parser.log.mortgageused).to be_nil

34
spec/services/bulk_upload/sales/year2024/row_parser_spec.rb

@ -301,7 +301,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "fetches the question's check_answer_label if it exists" do
parser.valid?
expect(parser.errors[:field_32]).to eql(["You must answer buyer 1’s gender identity"])
expect(parser.errors[:field_32]).to eql(["You must answer buyer 1’s gender identity."])
end
end
@ -310,7 +310,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "only has one error added to the field" do
parser.valid?
expect(parser.errors[:field_23]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_23]).to eql(["You must answer address line 1."])
end
end
end
@ -453,7 +453,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "is not permitted as setup error" do
parser.valid?
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation"])
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation."])
end
it "blocks log creation" do
@ -991,10 +991,10 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "adds errors to missing key address fields" do
parser.valid?
expect(parser.errors[:field_23]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_25]).to eql(["You must answer town or city"])
expect(parser.errors[:field_27]).to eql(["You must answer part 1 of postcode"])
expect(parser.errors[:field_28]).to eql(["You must answer part 2 of postcode"])
expect(parser.errors[:field_23]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_25]).to eql(["You must answer town or city."])
expect(parser.errors[:field_27]).to eql(["You must answer part 1 of postcode."])
expect(parser.errors[:field_28]).to eql(["You must answer part 2 of postcode."])
end
end
@ -1022,11 +1022,11 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "adds appropriate errors to UPRN and key address fields" do
parser.valid?
expect(parser.errors[:field_22]).to eql(["You must answer UPRN"])
expect(parser.errors[:field_23]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_25]).to eql(["You must answer town or city"])
expect(parser.errors[:field_27]).to eql(["You must answer part 1 of postcode"])
expect(parser.errors[:field_28]).to eql(["You must answer part 2 of postcode"])
expect(parser.errors[:field_22]).to eql(["You must answer UPRN."])
expect(parser.errors[:field_23]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_25]).to eql(["You must answer town or city."])
expect(parser.errors[:field_27]).to eql(["You must answer part 1 of postcode."])
expect(parser.errors[:field_28]).to eql(["You must answer part 2 of postcode."])
end
end
@ -1035,8 +1035,8 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "adds errors to UPRN and the missing key address field" do
parser.valid?
expect(parser.errors[:field_22]).to eql(["You must answer UPRN"])
expect(parser.errors[:field_23]).to eql(["You must answer address line 1"])
expect(parser.errors[:field_22]).to eql(["You must answer UPRN."])
expect(parser.errors[:field_23]).to eql(["You must answer address line 1."])
expect(parser.errors[:field_25]).to be_empty
expect(parser.errors[:field_27]).to be_empty
expect(parser.errors[:field_28]).to be_empty
@ -1313,7 +1313,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it "returns correct errors" do
parser.valid?
expect(parser.errors[:field_103]).to include("Enter a valid value for Was a mortgage used for the purchase of this property? - Shared ownership")
expect(parser.errors[:field_103]).to include("Enter a valid value for was a mortgage used for the purchase of this property? - Shared ownership.")
parser.log.blank_invalid_non_setup_fields!
parser.log.save!
@ -1963,7 +1963,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
parser.valid?
setup_errors = parser.errors.select { |e| e.options[:category] == :setup }
expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer reported by")
expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer reported by.")
end
it "blocks log creation" do
@ -1979,7 +1979,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
parser.valid?
setup_errors = parser.errors.select { |e| e.options[:category] == :setup }
expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer reported by")
expect(setup_errors.find { |e| e.attribute == :field_2 }.message).to eql("You must answer reported by.")
end
it "blocks log creation" do

6
spec/services/uprn_client_spec.rb

@ -21,7 +21,7 @@ describe UprnClient do
end
it "returns error" do
expect(client.error).to eq("UPRN is not recognised. Check the number, or enter the address")
expect(client.error).to eq("UPRN is not recognised. Check the number, or enter the address.")
end
end
@ -33,7 +33,7 @@ describe UprnClient do
end
it "returns error" do
expect(client.error).to eq("UPRN is not recognised. Check the number, or enter the address")
expect(client.error).to eq("UPRN is not recognised. Check the number, or enter the address.")
end
end
@ -66,7 +66,7 @@ describe UprnClient do
end
it "returns error" do
expect(client.error).to eq("UPRN is not recognised. Check the number, or enter the address")
expect(client.error).to eq("UPRN is not recognised. Check the number, or enter the address.")
end
end
end

Loading…
Cancel
Save