Merge pull request #8704 from demarches-simplifiees/fix/communes
fix possible values
This commit is contained in:
commit
e426a623e4
5 changed files with 9 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class TypesDeChamp::PrefillEpciTypeDeChamp < TypesDeChamp::PrefillTypeDeChamp
|
||||
def possible_values
|
||||
def all_possible_values
|
||||
departements.map do |departement|
|
||||
"#{departement[:code]} (#{departement[:name]}) : https://geo.api.gouv.fr/epcis?codeDepartement=#{departement[:code]}"
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -17,11 +17,11 @@ RSpec.describe TypesDeChamp::PrefillEpciTypeDeChamp 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/epcis?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 }
|
||||
|
||||
before do
|
||||
VCR.insert_cassette('api_geo_departements')
|
||||
|
@ -33,7 +33,7 @@ RSpec.describe TypesDeChamp::PrefillEpciTypeDeChamp do
|
|||
VCR.eject_cassette('api_geo_epcis')
|
||||
end
|
||||
|
||||
it { expect(possible_values).to match(expected_values) }
|
||||
it { expect(all_possible_values).to match(expected_values) }
|
||||
end
|
||||
|
||||
describe '#example_value' do
|
||||
|
|
Loading…
Reference in a new issue