Merge pull request #729 from sgmap/fix_727
[Fix #727] Engagement champ should behave like checkbox when displayed
This commit is contained in:
commit
ce738913e0
2 changed files with 14 additions and 1 deletions
|
@ -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'
|
||||
|
|
|
@ -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 }
|
||||
|
||||
|
|
Loading…
Reference in a new issue