From 5a1404e5deed48da7b174939b459e604af140a40 Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Thu, 6 Apr 2023 15:21:37 +0100 Subject: [PATCH] test: that validate_nulls gets header if check_answer_label is missing --- .../bulk_upload/lettings/year2023/row_parser_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index 304ccf32e..0c12db8fb 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -236,6 +236,16 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do expect(questions.map(&:id)).to eql([]) end end + + describe "#validate_nulls" do + let(:attributes) { { bulk_upload:, field_19: "", field_21: "" } } + + it "fetches the question's check_answer_label if it exists, otherwise it get's the question's header" do + parser.valid? + expect(parser.errors[:field_19]).to eql(["You must answer q12 - address"]) + expect(parser.errors[:field_21]).to eql(["You must answer town or city"]) + end + end end context "when setup section not complete" do