Group API Entreprise mock responses in a folder

This commit is contained in:
gregoirenovel 2018-10-15 17:04:51 +02:00
parent 7ae5e8ce52
commit dc28e79ab4
13 changed files with 21 additions and 21 deletions

View file

@ -31,12 +31,12 @@ feature 'user path for dossier creation' do
context 'sets siret' do
before do
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
.to_return(body: File.read('spec/support/files/api_entreprise/etablissements.json', status: 200))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/entreprises.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/exercices.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
.to_return(status: 404, body: '')

View file

@ -67,11 +67,11 @@ feature 'As a User I wanna create a dossier' do
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/etablissements.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/entreprises.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/exercices.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
.to_return(status: 404, body: '')

View file

@ -27,11 +27,11 @@ feature 'user arrive on siret page' do
context 'when enter a siret', js: true do
before do
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/etablissements\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/etablissements.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/entreprises\/#{siren}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/entreprises.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/exercices\/#{siret}?.*token=/)
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
.to_return(status: 200, body: File.read('spec/support/files/api_entreprise/exercices.json'))
stub_request(:get, /https:\/\/entreprise.api.gouv.fr\/v2\/associations\/#{siret}?.*token=/)
.to_return(status: 404, body: '')