fix drop down other
This commit is contained in:
parent
50ef8432a8
commit
f8c7003192
2 changed files with 25 additions and 1 deletions
|
@ -56,7 +56,7 @@ class Champs::DropDownListChamp < Champ
|
||||||
end
|
end
|
||||||
|
|
||||||
def drop_down_other?
|
def drop_down_other?
|
||||||
drop_down_other
|
drop_down_other == "1" || drop_down_other == true
|
||||||
end
|
end
|
||||||
|
|
||||||
def value=(value)
|
def value=(value)
|
||||||
|
|
24
spec/models/champs/drop_down_list_champ_spec.rb
Normal file
24
spec/models/champs/drop_down_list_champ_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
describe Champs::DropDownListChamp do
|
||||||
|
describe '#drop_down_other?' do
|
||||||
|
let(:drop_down) { create(:champ_drop_down_list) }
|
||||||
|
|
||||||
|
context 'when drop_down_other is nil' do
|
||||||
|
it do
|
||||||
|
drop_down.type_de_champ.drop_down_other = nil
|
||||||
|
expect(drop_down.drop_down_other?).to be false
|
||||||
|
|
||||||
|
drop_down.type_de_champ.drop_down_other = "0"
|
||||||
|
expect(drop_down.drop_down_other?).to be false
|
||||||
|
|
||||||
|
drop_down.type_de_champ.drop_down_other = false
|
||||||
|
expect(drop_down.drop_down_other?).to be false
|
||||||
|
|
||||||
|
drop_down.type_de_champ.drop_down_other = "1"
|
||||||
|
expect(drop_down.drop_down_other?).to be true
|
||||||
|
|
||||||
|
drop_down.type_de_champ.drop_down_other = true
|
||||||
|
expect(drop_down.drop_down_other?).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue