From 2f22b004a2cc122d77fe96ad13e557c1474e03bc Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Tue, 18 Apr 2023 16:54:17 +0100 Subject: [PATCH] refactor: rename validate_fields_count and wrong_field_count --- app/services/bulk_upload/lettings/validator.rb | 6 +++--- config/locales/en.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/bulk_upload/lettings/validator.rb b/app/services/bulk_upload/lettings/validator.rb index e3f4b004f..f74a108a1 100644 --- a/app/services/bulk_upload/lettings/validator.rb +++ b/app/services/bulk_upload/lettings/validator.rb @@ -9,7 +9,7 @@ class BulkUpload::Lettings::Validator attr_reader :bulk_upload, :path validate :validate_file_not_empty - validate :validate_fields_count + validate :validate_field_numbers_count def initialize(bulk_upload:, path:) @bulk_upload = bulk_upload @@ -128,10 +128,10 @@ private end end - def validate_fields_count + def validate_field_numbers_count return if halt_validations? - errors.add(:base, :wrong_field_count) if csv_parser.valid_field_numbers_count != csv_parser.class::FIELDS + errors.add(:base, :wrong_field_numbers_count) if csv_parser.valid_field_numbers_count != csv_parser.class::FIELDS end def halt_validations! diff --git a/config/locales/en.yml b/config/locales/en.yml index 1c30062f3..670a6df9a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -44,7 +44,7 @@ en: bulk_upload/lettings/validator: attributes: base: - wrong_field_count: "incorrect number of fields, please ensure you have used the correct template" + wrong_field_numbers_count: "incorrect number of fields, please ensure you have used the correct template" forms/bulk_upload_lettings/year: attributes: year: