diff --git a/app/services/bulk_upload/sales/year2023/row_parser.rb b/app/services/bulk_upload/sales/year2023/row_parser.rb index 1e1bfbc0c..f64260584 100644 --- a/app/services/bulk_upload/sales/year2023/row_parser.rb +++ b/app/services/bulk_upload/sales/year2023/row_parser.rb @@ -1163,7 +1163,7 @@ private if setup_question?(question) fields.each do |field| - if errors[field].blank? + if errors[field].none? block_log_creation! errors.add(field, I18n.t("validations.invalid_option", question: QUESTIONS[field]), category: :setup) end diff --git a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb index 4f1e87b0f..5d7bb6d47 100644 --- a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb @@ -565,6 +565,16 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do end end + describe "#field_7" do # ownership scheme + context "when an invalid option" do + let(:attributes) { setup_section_params.merge({ field_7: "100" }) } + + it "returns setup error" do + expect(parser.errors.where(:field_7, category: :setup)).to be_present + end + end + end + describe "#field_19" do # UPRN context "when UPRN known and lookup found" do let(:attributes) { setup_section_params.merge({ field_19: "100023336956" }) }