Browse Source

add ecstatN fields to bulk upload

remotes/origin/bulk-upload-errors-integration
Phil Lee 3 years ago
parent
commit
67a3bb3c08
  1. 14
      app/services/bulk_upload/lettings/row_parser.rb
  2. 34
      spec/services/bulk_upload/lettings/row_parser_spec.rb

14
app/services/bulk_upload/lettings/row_parser.rb

@ -262,6 +262,13 @@ private
national: %i[field_44], national: %i[field_44],
ecstat1: %i[field_35], ecstat1: %i[field_35],
ecstat2: %i[field_36],
ecstat3: %i[field_37],
ecstat4: %i[field_38],
ecstat5: %i[field_39],
ecstat6: %i[field_40],
ecstat7: %i[field_41],
ecstat8: %i[field_42],
armedforces: %i[field_45], armedforces: %i[field_45],
leftreg: %i[field_114], leftreg: %i[field_114],
@ -406,6 +413,13 @@ private
attributes["national"] = field_44 attributes["national"] = field_44
attributes["ecstat1"] = field_35 attributes["ecstat1"] = field_35
attributes["ecstat2"] = field_36
attributes["ecstat3"] = field_37
attributes["ecstat4"] = field_38
attributes["ecstat5"] = field_39
attributes["ecstat6"] = field_40
attributes["ecstat7"] = field_41
attributes["ecstat8"] = field_42
attributes["armedforces"] = field_45 attributes["armedforces"] = field_45
attributes["leftreg"] = leftreg attributes["leftreg"] = leftreg

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

@ -93,6 +93,13 @@ RSpec.describe BulkUpload::Lettings::RowParser do
field_44: "18", field_44: "18",
field_35: "1", field_35: "1",
field_36: "2",
field_37: "6",
field_38: "7",
field_39: "8",
field_40: "9",
field_41: "0",
field_42: "10",
field_45: "1", field_45: "1",
field_114: "4", field_114: "4",
@ -381,5 +388,32 @@ RSpec.describe BulkUpload::Lettings::RowParser do
expect(parser.log.sex8).to eql("R") expect(parser.log.sex8).to eql("R")
end end
end end
describe "#ecstatN fields" do
let(:attributes) do
{
bulk_upload:,
field_35: "1",
field_36: "2",
field_37: "6",
field_38: "7",
field_39: "8",
field_40: "9",
field_41: "0",
field_42: "10",
}
end
it "sets value from correct mapping", aggregate_failures: true do
expect(parser.log.ecstat1).to eq(1)
expect(parser.log.ecstat2).to eq(2)
expect(parser.log.ecstat3).to eq(6)
expect(parser.log.ecstat4).to eq(7)
expect(parser.log.ecstat5).to eq(8)
expect(parser.log.ecstat6).to eq(9)
expect(parser.log.ecstat7).to eq(0)
expect(parser.log.ecstat8).to eq(10)
end
end
end end
end end

Loading…
Cancel
Save