fix communes: all possible values

This commit is contained in:
sebastiencarceles 2023-02-28 08:36:43 +01:00
parent da5618b9fc
commit 2ae2d99e93
3 changed files with 5 additions and 5 deletions

View file

@ -1,5 +1,5 @@
class TypesDeChamp::PrefillCommuneTypeDeChamp < TypesDeChamp::PrefillTypeDeChamp
def possible_values
def all_possible_values
departements.map do |departement|
"#{departement[:code]} (#{departement[:name]}) : https://geo.api.gouv.fr/communes?codeDepartement=#{departement[:code]}"
end

View file

@ -27,7 +27,7 @@
%td
.fr-grid-row.fr-grid-row--gutters.fr-py-5w
- @type_de_champ.all_possible_values.each do |possible_value|
.fr-col-lg-3.fr-col-md-4.fr-col-sm-6.fr-col-12
.fr-col-md-4.fr-col-sm-6.fr-col-12
= possible_value
%tr
%th

View file

@ -26,13 +26,13 @@ RSpec.describe TypesDeChamp::PrefillCommuneTypeDeChamp do
it { is_expected.to be_kind_of(TypesDeChamp::PrefillTypeDeChamp) }
end
describe '#possible_values' do
describe '#all_possible_values' do
let(:expected_values) do
departements.map { |departement| "#{departement[:code]} (#{departement[:name]}) : https://geo.api.gouv.fr/communes?codeDepartement=#{departement[:code]}" }
end
subject(:possible_values) { described_class.new(type_de_champ, procedure.active_revision).possible_values }
subject(:all_possible_values) { described_class.new(type_de_champ, procedure.active_revision).all_possible_values }
it { expect(possible_values).to match(expected_values) }
it { expect(all_possible_values).to match(expected_values) }
end
describe '#example_value' do