Merge branch 'main' into fix-experts-lookup
This commit is contained in:
commit
38837443aa
2 changed files with 8 additions and 0 deletions
|
@ -94,6 +94,8 @@ class Champ < ApplicationRecord
|
||||||
case type_de_champ.type_champ
|
case type_de_champ.type_champ
|
||||||
when TypeDeChamp.type_champs.fetch(:carte)
|
when TypeDeChamp.type_champs.fetch(:carte)
|
||||||
geo_areas.blank? || value == '[]'
|
geo_areas.blank? || value == '[]'
|
||||||
|
when TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)
|
||||||
|
value.blank? || value == '[]'
|
||||||
else
|
else
|
||||||
value.blank?
|
value.blank?
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,12 @@ shared_examples 'champ_spec' do
|
||||||
it { expect(champ.mandatory_and_blank?).to be(true) }
|
it { expect(champ.mandatory_and_blank?).to be(true) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when multiple_drop_down_list mandatory and blank' do
|
||||||
|
let(:type_de_champ) { build(:type_de_champ_multiple_drop_down_list, mandatory: mandatory) }
|
||||||
|
let(:value) { '[]' }
|
||||||
|
it { expect(champ.mandatory_and_blank?).to be(true) }
|
||||||
|
end
|
||||||
|
|
||||||
context 'when not blank' do
|
context 'when not blank' do
|
||||||
let(:value) { 'yop' }
|
let(:value) { 'yop' }
|
||||||
it { expect(champ.mandatory_and_blank?).to be(false) }
|
it { expect(champ.mandatory_and_blank?).to be(false) }
|
||||||
|
|
Loading…
Reference in a new issue