Merge pull request #956 from sgmap/fix_export_for_yes_no_champ
Fix export for yes_no champs
This commit is contained in:
commit
deb3f02903
2 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue