From 0bde65d6bb0fe47b2c45c416d4be41c3b453e947 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 9 Jun 2023 18:00:20 +0100 Subject: [PATCH] feat: update tests --- app/controllers/form_controller.rb | 2 +- app/models/log.rb | 2 +- spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index f56583257..50bf06c15 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -95,7 +95,7 @@ private next unless question_params if %w[checkbox validation_override].include?(question.type) - question.answer_options.answer_keys_without_dividers.each do |option| + question.answer_keys_without_dividers.each do |option| result[option] = question_params.include?(option) ? 1 : 0 end else diff --git a/app/models/log.rb b/app/models/log.rb index acbd6962e..bb5ba23fc 100644 --- a/app/models/log.rb +++ b/app/models/log.rb @@ -107,7 +107,7 @@ class Log < ApplicationRecord next if setup_ids.include?(error.attribute.to_s) question = form.questions.find { |q| q.id == error.attribute.to_s } - if question.type == "checkbox" + if question&.type == "checkbox" question.answer_keys_without_dividers.each { |attribute| public_send("#{attribute}=", nil) } else public_send("#{error.attribute}=", nil) 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 99b5c5aa6..c70601c6d 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -205,7 +205,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do field_101: "2", field_102: "31", field_104: "3", - field_105: "12", + field_105: "11", field_106: "1", field_107: "EC1N",