Browse Source

tweak blank error message for bulk upload (#1211)

pull/1212/head
Phil Lee 2 years ago committed by GitHub
parent
commit
adebe409f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/services/bulk_upload/lettings/row_parser.rb
  2. 4
      spec/services/bulk_upload/lettings/row_parser_spec.rb

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

@ -205,7 +205,7 @@ private
next if log.optional_fields.include?(question.id)
next if question.completed?(log)
fields.each { |field| errors.add(field, :blank) }
fields.each { |field| errors.add(field, I18n.t("validations.not_answered", question: question.check_answer_label&.downcase)) }
end
end

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

@ -279,6 +279,10 @@ RSpec.describe BulkUpload::Lettings::RowParser do
it "returns an error" do
expect(parser.errors[:field_103]).to be_present
end
it "populates with correct error message" do
expect(parser.errors[:field_103]).to eql(["You must answer type of building"])
end
end
context "when unpermitted values" do

Loading…
Cancel
Save