Browse Source

CLDC-2499 Fix housingneeds_type bug (#1746)

* feat: set none of listed options for housingneeds_type in bu parsers

* feat: add tests
pull/1751/head v0.3.35
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
ab33b181fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/services/bulk_upload/lettings/year2022/row_parser.rb
  2. 2
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  3. 9
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb
  4. 9
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

2
app/services/bulk_upload/lettings/year2022/row_parser.rb

@ -1461,6 +1461,8 @@ private
1
elsif field_57 == 1
2
else
3
end
end

2
app/services/bulk_upload/lettings/year2023/row_parser.rb

@ -1403,6 +1403,8 @@ private
1
elsif field_85 == 1
2
else
3
end
end

9
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -1728,6 +1728,15 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
end
end
context "when housingneeds are not given" do
let(:attributes) { { bulk_upload:, field_55: nil, field_56: nil, field_57: nil, field_59: nil } }
it "sets correct housingneeds" do
expect(parser.log.housingneeds).to eq(1)
expect(parser.log.housingneeds_type).to eq(3)
end
end
context "when housingneeds a and b are selected" do
let(:attributes) { { bulk_upload:, field_55: "1", field_56: "1" } }

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

@ -1790,6 +1790,15 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
end
end
context "when housingneeds are not given" do
let(:attributes) { { bulk_upload:, field_83: nil, field_84: nil, field_85: nil, field_87: nil } }
it "sets correct housingneeds" do
expect(parser.log.housingneeds).to eq(1)
expect(parser.log.housingneeds_type).to eq(3)
end
end
context "when housingneeds a and b are selected" do
let(:attributes) { { bulk_upload:, field_83: "1", field_84: "1" } }

Loading…
Cancel
Save