diff --git a/app/decorators/champ_decorator.rb b/app/decorators/champ_decorator.rb index 1e1995de7..4652d5d08 100644 --- a/app/decorators/champ_decorator.rb +++ b/app/decorators/champ_decorator.rb @@ -4,7 +4,7 @@ class ChampDecorator < Draper::Decorator def value if type_champ == "date" && object.value.present? Date.parse(object.value).strftime("%d/%m/%Y") - elsif type_champ == 'checkbox' + elsif type_champ.in? ["checkbox", "engagement"] object.value == 'on' ? 'Oui' : 'Non' elsif type_champ == 'yes_no' if object.value == 'true' diff --git a/spec/decorators/champ_decorator_spec.rb b/spec/decorators/champ_decorator_spec.rb index c0817e4b6..2dc572ec5 100644 --- a/spec/decorators/champ_decorator_spec.rb +++ b/spec/decorators/champ_decorator_spec.rb @@ -20,6 +20,19 @@ describe ChampDecorator do end end + describe 'for a engagement' do + let(:type_champ) { :engagement } + + context 'when value is on' do + before { champ.update value: 'on' } + it { is_expected.to eq 'Oui' } + end + + context 'when value is other' do + it { is_expected.to eq 'Non' } + end + end + describe 'for a multiple_drop_down_list' do let(:type_champ) { :multiple_drop_down_list }