From a255e61556db744516c3879187429b27c6af2c66 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 5 Feb 2019 16:41:21 +0100 Subject: [PATCH] [#3356] Improve formatting for menus that only have a primary value --- app/models/champs/linked_drop_down_list_champ.rb | 2 +- spec/models/concern/tags_substitution_concern_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/champs/linked_drop_down_list_champ.rb b/app/models/champs/linked_drop_down_list_champ.rb index cb4ff4ae8..d28b3004f 100644 --- a/app/models/champs/linked_drop_down_list_champ.rb +++ b/app/models/champs/linked_drop_down_list_champ.rb @@ -30,7 +30,7 @@ class Champs::LinkedDropDownListChamp < Champ end def to_s - value.present? ? [primary_value, secondary_value].compact.join(' / ') : "" + value.present? ? [primary_value, secondary_value].select(&:present?).join(' / ') : "" end def for_export diff --git a/spec/models/concern/tags_substitution_concern_spec.rb b/spec/models/concern/tags_substitution_concern_spec.rb index 7c68e1fbf..b2a640214 100644 --- a/spec/models/concern/tags_substitution_concern_spec.rb +++ b/spec/models/concern/tags_substitution_concern_spec.rb @@ -129,7 +129,7 @@ describe TagsSubstitutionConcern, type: :model do c.primary_value = 'primo' c.save end - it { is_expected.to eq('tout : primo / , primaire : primo, secondaire : ') } + it { is_expected.to eq('tout : primo, primaire : primo, secondaire : ') } end context 'and the champ has a primary and secondary value' do