Browse Source

feat: update org errors and tests

pull/2338/head
natdeanlewissoftwire 9 months ago
parent
commit
afe436a370
  1. 6
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 4
      app/services/bulk_upload/sales/year2024/row_parser.rb
  3. 2
      spec/services/bulk_upload/sales/year2024/row_parser_spec.rb

6
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -809,7 +809,7 @@ private
if managing_organisation.nil?
block_log_creation!
if errors[:field_2].blank?
if field_2.present? && errors[:field_2].blank?
errors.add(:field_2, "The managing organisation code is incorrect", category: :setup)
end
end
@ -818,7 +818,7 @@ private
def validate_managing_org_data_given
if field_2.blank?
block_log_creation!
errors.add(:field_2, "The managing organisation code is incorrect", category: :setup)
errors.add(:field_2, I18n.t("validations.not_answered", question: "managing organisation"), category: :setup)
end
end
@ -836,7 +836,7 @@ private
if owning_organisation.nil?
block_log_creation!
if errors[:field_1].blank?
if field_1.present? && errors[:field_1].blank?
errors.add(:field_1, "The owning organisation code is incorrect", category: :setup)
end
end

4
app/services/bulk_upload/sales/year2024/row_parser.rb

@ -1260,7 +1260,7 @@ private
block_log_creation!
if errors[:field_1].blank?
errors.add(:field_1, "The owning organisation code is incorrect", category: :setup)
errors.add(:field_1, I18n.t("validations.not_answered", question: "owning organisation"), category: :setup)
end
end
end
@ -1269,7 +1269,7 @@ private
if owning_organisation.nil?
block_log_creation!
if errors[:field_1].blank?
if field_1.present? && errors[:field_1].blank?
errors.add(:field_1, "The owning organisation code is incorrect", category: :setup)
end
end

2
spec/services/bulk_upload/sales/year2024/row_parser_spec.rb

@ -438,7 +438,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
let(:attributes) { { bulk_upload:, field_1: "donotexist" } }
it "is not permitted as a setup error" do
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["You must answer owning organisation"])
expect(parser.errors.where(:field_1, category: :setup).map(&:message)).to eql(["The owning organisation code is incorrect"])
end
it "blocks log creation" do

Loading…
Cancel
Save