Champ: export yes_no champ with oui non
This commit is contained in:
parent
338911d1a8
commit
b658f8c8dc
2 changed files with 17 additions and 0 deletions
|
@ -75,6 +75,8 @@ class Champ < ActiveRecord::Base
|
|||
case type_champ
|
||||
when 'textarea'
|
||||
ActionView::Base.full_sanitizer.sanitize(value)
|
||||
when 'yes_no'
|
||||
value == 'yes' ? 'oui' : 'non'
|
||||
else
|
||||
value
|
||||
end
|
||||
|
|
|
@ -84,5 +84,20 @@ describe Champ do
|
|||
it { expect(champ.for_export).to eq('gras') }
|
||||
end
|
||||
|
||||
context 'when type_de_champ is yes_no' do
|
||||
let(:type_champ) { 'yes_no' }
|
||||
|
||||
context 'if yes' do
|
||||
let(:value) { 'yes' }
|
||||
|
||||
it { expect(champ.for_export).to eq('oui') }
|
||||
end
|
||||
|
||||
context 'if no' do
|
||||
let(:value) { 'no' }
|
||||
|
||||
it { expect(champ.for_export).to eq('non') }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue