Browse Source

ensure valid radio option errors added

pull/1633/head
Phil Lee 3 years ago
parent
commit
c96bcc985b
  1. 2
      app/services/bulk_upload/sales/year2023/row_parser.rb
  2. 10
      spec/services/bulk_upload/sales/year2023/row_parser_spec.rb

2
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

10
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" }) }

Loading…
Cancel
Save