fix communes: all possible values
This commit is contained in:
parent
da5618b9fc
commit
2ae2d99e93
3 changed files with 5 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
class TypesDeChamp::PrefillCommuneTypeDeChamp < TypesDeChamp::PrefillTypeDeChamp
|
class TypesDeChamp::PrefillCommuneTypeDeChamp < TypesDeChamp::PrefillTypeDeChamp
|
||||||
def possible_values
|
def all_possible_values
|
||||||
departements.map do |departement|
|
departements.map do |departement|
|
||||||
"#{departement[:code]} (#{departement[:name]}) : https://geo.api.gouv.fr/communes?codeDepartement=#{departement[:code]}"
|
"#{departement[:code]} (#{departement[:name]}) : https://geo.api.gouv.fr/communes?codeDepartement=#{departement[:code]}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
%td
|
%td
|
||||||
.fr-grid-row.fr-grid-row--gutters.fr-py-5w
|
.fr-grid-row.fr-grid-row--gutters.fr-py-5w
|
||||||
- @type_de_champ.all_possible_values.each do |possible_value|
|
- @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
|
= possible_value
|
||||||
%tr
|
%tr
|
||||||
%th
|
%th
|
||||||
|
|
|
@ -26,13 +26,13 @@ RSpec.describe TypesDeChamp::PrefillCommuneTypeDeChamp do
|
||||||
it { is_expected.to be_kind_of(TypesDeChamp::PrefillTypeDeChamp) }
|
it { is_expected.to be_kind_of(TypesDeChamp::PrefillTypeDeChamp) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#possible_values' do
|
describe '#all_possible_values' do
|
||||||
let(:expected_values) do
|
let(:expected_values) do
|
||||||
departements.map { |departement| "#{departement[:code]} (#{departement[:name]}) : https://geo.api.gouv.fr/communes?codeDepartement=#{departement[:code]}" }
|
departements.map { |departement| "#{departement[:code]} (#{departement[:name]}) : https://geo.api.gouv.fr/communes?codeDepartement=#{departement[:code]}" }
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe '#example_value' do
|
describe '#example_value' do
|
||||||
|
|
Loading…
Reference in a new issue