diff --git a/app/models/champ.rb b/app/models/champ.rb index ee0ee446f..872a6a996 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -78,7 +78,7 @@ class Champ < ActiveRecord::Base when 'textarea' ActionView::Base.full_sanitizer.sanitize(value) when 'yes_no' - value == 'yes' ? 'oui' : 'non' + value == 'true' ? 'oui' : 'non' when 'multiple_drop_down_list' drop_down_list.selected_options_without_decorator(self).join(', ') else diff --git a/spec/models/champ_spec.rb b/spec/models/champ_spec.rb index 40435750a..1db3481da 100644 --- a/spec/models/champ_spec.rb +++ b/spec/models/champ_spec.rb @@ -88,16 +88,22 @@ describe Champ do let(:type_champ) { 'yes_no' } context 'if yes' do - let(:value) { 'yes' } + let(:value) { 'true' } it { expect(champ.for_export).to eq('oui') } end context 'if no' do - let(:value) { 'no' } + let(:value) { 'false' } it { expect(champ.for_export).to eq('non') } end + + context 'if nil' do + let(:value) { nil } + + it { expect(champ.for_export).to eq(nil) } + end end context 'when type_de_champ is multiple_drop_down_list' do