From b99a2046d63d8270e5d04db62363843a898092e7 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Mon, 15 May 2023 17:05:32 +0100 Subject: [PATCH] refactor test --- .../bulk_upload/sales/year2022/row_parser_spec.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/services/bulk_upload/sales/year2022/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2022/row_parser_spec.rb index 5758a3701..b10d07135 100644 --- a/spec/services/bulk_upload/sales/year2022/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2022/row_parser_spec.rb @@ -477,11 +477,9 @@ RSpec.describe BulkUpload::Sales::Year2022::RowParser do let(:attributes) { setup_section_params.merge({ field_2: nil, field_3: nil, field_4: nil }) } it "returns them as setup errors" do - setup_errors = parser.errors.select { |e| e.options[:category] == :setup } - - expect(setup_errors.find { |e| e.attribute == :field_2 }).to be_present - expect(setup_errors.find { |e| e.attribute == :field_3 }).to be_present - expect(setup_errors.find { |e| e.attribute == :field_4 }).to be_present + expect(parser.errors.where(:field_2, category: :setup)).to be_present + expect(parser.errors.where(:field_3, category: :setup)).to be_present + expect(parser.errors.where(:field_4, category: :setup)).to be_present end end