From 8abbbafd9244e7ae8a2b306c0866ab6e30e4516f Mon Sep 17 00:00:00 2001 From: Yetrina Battad Date: Thu, 13 Jun 2024 09:10:33 +1000 Subject: [PATCH] fix: return nil extent information to avoid displaying an empty heading --- app/models/solr_document.rb | 4 +++- spec/models/solr_document_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/solr_document.rb b/app/models/solr_document.rb index 32a896cf..cbcf60e8 100644 --- a/app/models/solr_document.rb +++ b/app/models/solr_document.rb @@ -43,11 +43,13 @@ def extents_information physdesc_facet ].compact.join(", ") - if quantity_unittype.blank? + extent_info = if quantity_unittype.blank? dimensions_facet else [quantity_unittype, dimensions_facet].compact.join(", ") end + + extent_info.presence end def extract_notes_by_header(header) diff --git a/spec/models/solr_document_spec.rb b/spec/models/solr_document_spec.rb index 4e5ef44c..4a3af88f 100644 --- a/spec/models/solr_document_spec.rb +++ b/spec/models/solr_document_spec.rb @@ -108,8 +108,8 @@ document.extents_information end - it "returns an empty string" do - expect(extents_information_value).to eq "" + it "returns nil" do + expect(extents_information_value).to be_nil end end end