From 4beead8a68f02333f2a68b9a2e4b477ed3d92058 Mon Sep 17 00:00:00 2001 From: moveson Date: Wed, 13 Mar 2024 18:07:29 -0600 Subject: [PATCH] Revert smarter_csv duplicate header behavior to version 1.9 --- lib/etl/extractors/csv_file_strategy.rb | 3 ++- spec/lib/etl/extractors/csv_file_strategy_spec.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/etl/extractors/csv_file_strategy.rb b/lib/etl/extractors/csv_file_strategy.rb index d50c994fc..a08b8207f 100644 --- a/lib/etl/extractors/csv_file_strategy.rb +++ b/lib/etl/extractors/csv_file_strategy.rb @@ -11,11 +11,12 @@ class CsvFileStrategy BYTE_ORDER_MARK = String.new("\xEF\xBB\xBF").force_encoding("UTF-8").freeze IMPORT_OPTIONS = { downcase_header: false, + duplicate_header_suffix: nil, force_utf8: true, remove_empty_values: false, row_sep: :auto, strip_chars_from_headers: BYTE_ORDER_MARK, - strings_as_keys: true + strings_as_keys: true, }.freeze attr_reader :errors diff --git a/spec/lib/etl/extractors/csv_file_strategy_spec.rb b/spec/lib/etl/extractors/csv_file_strategy_spec.rb index 98a55a4b9..894cb638d 100644 --- a/spec/lib/etl/extractors/csv_file_strategy_spec.rb +++ b/spec/lib/etl/extractors/csv_file_strategy_spec.rb @@ -96,7 +96,7 @@ error = subject.errors.first expect(error[:title]).to eq("CSV error") - expect(error[:detail][:messages]).to include("ERROR: duplicate headers: country,country") + expect(error[:detail][:messages]).to include('Duplicate Headers in CSV: {"country"=>2}') end end end