From 243d7a54b1015a39b8d5afc0e12ec904ccf6c811 Mon Sep 17 00:00:00 2001 From: Cory Lown Date: Tue, 12 Mar 2024 14:50:53 -0400 Subject: [PATCH] Return nil instead of an empty string from normalized_date --- lib/arclight/normalized_date.rb | 2 +- spec/lib/arclight/normalized_date_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/arclight/normalized_date.rb b/lib/arclight/normalized_date.rb index e1a2cf111..8fdc9c43c 100644 --- a/lib/arclight/normalized_date.rb +++ b/lib/arclight/normalized_date.rb @@ -43,7 +43,7 @@ def normalize result << inclusive if inclusive.present? result << other if other.present? result << "bulk #{bulk}" if bulk.present? - result.compact.map(&:strip).join(', ') + result.compact.map(&:strip).join(', ').presence end end end diff --git a/spec/lib/arclight/normalized_date_spec.rb b/spec/lib/arclight/normalized_date_spec.rb index aea180d2d..6f0eee863 100644 --- a/spec/lib/arclight/normalized_date_spec.rb +++ b/spec/lib/arclight/normalized_date_spec.rb @@ -84,7 +84,7 @@ let(:date_other) { nil } it 'does not know what to do' do - expect(normalized_date).to eq '' + expect(normalized_date).to be_nil end end end