feat(routing): add departements to routable_type_de_champ
This commit is contained in:
parent
cd5d89336c
commit
ac823c1b25
2 changed files with 13 additions and 1 deletions
|
@ -224,7 +224,7 @@ class ProcedureRevision < ApplicationRecord
|
|||
end
|
||||
|
||||
def routable_types_de_champ
|
||||
types_de_champ_public.filter { |tdc| [:drop_down_list].include?(tdc.type_champ.to_sym) }
|
||||
types_de_champ_public.filter { |tdc| [:drop_down_list, :departements].include?(tdc.type_champ.to_sym) }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -941,4 +941,16 @@ describe ProcedureRevision do
|
|||
expect(type_de_champ.revisions.count).to eq(1)
|
||||
}
|
||||
end
|
||||
|
||||
describe '#routable_types_de_champ' do
|
||||
let(:procedure) do
|
||||
create(:procedure).tap do |p|
|
||||
p.draft_revision.add_type_de_champ(type_champ: :text, libelle: 'l1')
|
||||
p.draft_revision.add_type_de_champ(type_champ: :drop_down_list, libelle: 'l2')
|
||||
p.draft_revision.add_type_de_champ(type_champ: :departements, libelle: 'l3')
|
||||
end
|
||||
end
|
||||
|
||||
it { expect(draft.routable_types_de_champ.pluck(:libelle)).to eq(['l2', 'l3']) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue