From 5345e290aa8e80b0961c62b20e3e49e141b58b23 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 4 May 2023 11:52:46 +0100 Subject: [PATCH] BU unrelated created_by user now a setup error --- app/services/bulk_upload/sales/year2023/row_parser.rb | 2 +- spec/services/bulk_upload/sales/year2023/row_parser_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/bulk_upload/sales/year2023/row_parser.rb b/app/services/bulk_upload/sales/year2023/row_parser.rb index 91b6a0d40..f8148a720 100644 --- a/app/services/bulk_upload/sales/year2023/row_parser.rb +++ b/app/services/bulk_upload/sales/year2023/row_parser.rb @@ -1040,7 +1040,7 @@ private unless created_by.organisation == owning_organisation block_log_creation! - errors.add(:field_2, "User must be related to owning organisation") + errors.add(:field_2, "User must be related to owning organisation", category: :setup) end end diff --git a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb index c64a1064e..c6f1fabac 100644 --- a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb @@ -372,8 +372,8 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do let(:attributes) { { bulk_upload:, field_1: owning_org.old_visible_id, field_2: other_user.email } } - it "is not permitted" do - expect(parser.errors[:field_2]).to be_present + it "is not permitted as a setup error" do + expect(parser.errors.where(:field_2, category: :setup)).to be_present end it "blocks log creation" do