Browse Source

test: check correct errors seen for all desired fields

cldc-1888-bulk-upload-duplicate-log-validation
Sam Seed 2 years ago
parent
commit
7592082f20
  1. 21
      spec/services/bulk_upload/lettings/row_parser_spec.rb

21
spec/services/bulk_upload/lettings/row_parser_spec.rb

@ -203,9 +203,26 @@ RSpec.describe BulkUpload::Lettings::RowParser do
expect(parser).not_to be_valid
end
it "adds an error to all fields used to determine duplicity" do
it "adds an error to all (and only) the fields used to determine duplicity" do
parser.valid?
expect(parser.errors.added?(:field_101, "test")).to be true
expected_errors = {
:field_96 => ["test"], # startdate
:field_97 => ["test"], # startdate
:field_98 => ["test"], # startdate
:field_108 => ["test"], # postcode_full
:field_109 => ["test"], # postcode_full
:field_80 => ["test"], # brent
:field_81 => ["test"], # scharge
:field_82 => ["test"], # pscharge
:field_83 => ["test"], # supcharg
:field_7 => ["test"], # tenancycode
:field_12 => ["test"], # age1
:field_20 => ["test"], # sex1
:field_35 => ["test"], # ecstat1
:field_43 => ["test"], # ethnic
}
expect(parser.errors.as_json).to eq(expected_errors)
end
end
end

Loading…
Cancel
Save