Add "99 - Étranger" in Champ département.
This commit is contained in:
parent
6f40424979
commit
c2f014e59f
3 changed files with 77 additions and 1 deletions
|
@ -39,7 +39,7 @@ class Champ < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.departements
|
||||
JSON.parse(Carto::GeoAPI::Driver.departements).inject([]){|acc, liste| acc.push(liste['code'] + ' - ' + liste['nom']) }
|
||||
JSON.parse(Carto::GeoAPI::Driver.departements).inject([]){|acc, liste| acc.push(liste['code'] + ' - ' + liste['nom']) }.push('99 - Étranger')
|
||||
end
|
||||
|
||||
def self.pays
|
||||
|
|
70
spec/fixtures/cassettes/call_geo_api_departements.yml
vendored
Normal file
70
spec/fixtures/cassettes/call_geo_api_departements.yml
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: get
|
||||
uri: https://geo.api.gouv.fr/departements?fields=nom
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*; q=0.5, application/xml"
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
User-Agent:
|
||||
- Ruby
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Server:
|
||||
- nginx
|
||||
Date:
|
||||
- Wed, 19 Oct 2016 09:31:34 GMT
|
||||
Content-Type:
|
||||
- application/json; charset=utf-8
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Connection:
|
||||
- keep-alive
|
||||
Vary:
|
||||
- Accept-Encoding
|
||||
- Accept-Encoding
|
||||
X-Powered-By:
|
||||
- Express
|
||||
Access-Control-Allow-Origin:
|
||||
- "*"
|
||||
Etag:
|
||||
- W/"cc1-lXUcIlpPmDfvrGONl0WWsQ"
|
||||
Strict-Transport-Security:
|
||||
- max-age=15552000
|
||||
Content-Encoding:
|
||||
- gzip
|
||||
body:
|
||||
encoding: ASCII-8BIT
|
||||
string: !binary |-
|
||||
H4sIAAAAAAAAA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dSt3eFKy86FXe09KiGuBaZeS4FrY
|
||||
+yK4synprWWZO/ticfJbO/exZ6TkdrDHiYTU1rp6IJCUzL6EMzQlrFtp3LvU
|
||||
N+uzXJ5dyOK7NmjOGeG9r6owU3bcGdur3h5zt88s8GDrk5Vr0XU0k+55AF0I
|
||||
s/CpjoySBUCFk5yHTSkj07kVuSy0/cFiguvi0tfujRJMsSy4M3O7F8FmkmAW
|
||||
irOb5smWiq/kLAnauNjrmi/YzF+Jb/8A5ygzwMEMAAA=
|
||||
http_version:
|
||||
recorded_at: Wed, 19 Oct 2016 09:31:33 GMT
|
||||
recorded_with: VCR 3.0.1
|
|
@ -35,4 +35,10 @@ shared_examples 'champ_spec' do
|
|||
it { is_expected.to eq 'typeahead' }
|
||||
end
|
||||
end
|
||||
|
||||
describe '.departement', vcr: {cassette_name: 'call_geo_api_departements'} do
|
||||
subject { Champ.departements }
|
||||
|
||||
it { expect(subject).to include '99 - Étranger' }
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue