Enable the Layout/MultilineMethodCallIndentation cop
This commit is contained in:
parent
b77837bfd1
commit
73dd58b6cd
21 changed files with 85 additions and 85 deletions
|
@ -142,7 +142,8 @@ Layout/MultilineMethodCallBraceLayout:
|
|||
EnforcedStyle: symmetrical
|
||||
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
Enabled: false
|
||||
Enabled: true
|
||||
EnforcedStyle: indented
|
||||
|
||||
Layout/MultilineMethodDefinitionBraceLayout:
|
||||
Enabled: false
|
||||
|
|
|
@ -240,12 +240,12 @@ module NewGestionnaire
|
|||
when 'user', 'etablissement', 'entreprise'
|
||||
if filter['column'] == 'date_creation'
|
||||
dossiers
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} = ?", filter['value'].to_date)
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} = ?", filter['value'].to_date)
|
||||
else
|
||||
dossiers
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
||||
end
|
||||
|
||||
end.pluck(:id)
|
||||
|
|
|
@ -54,8 +54,7 @@ class Gestionnaire < ActiveRecord::Base
|
|||
procedure_ids = followed_dossiers.pluck(:procedure_id)
|
||||
|
||||
if procedure_ids.include?(procedure.id)
|
||||
return followed_dossiers.where(procedure_id: procedure.id)
|
||||
.inject(0) do |acc, dossier|
|
||||
return followed_dossiers.where(procedure_id: procedure.id).inject(0) do |acc, dossier|
|
||||
acc += dossier.notifications.where(already_read: false).count
|
||||
end
|
||||
end
|
||||
|
@ -83,9 +82,9 @@ class Gestionnaire < ActiveRecord::Base
|
|||
start_date = DateTime.now.beginning_of_week
|
||||
|
||||
active_procedure_overviews = procedures
|
||||
.publiees
|
||||
.map { |procedure| procedure.procedure_overview(start_date) }
|
||||
.select(&:had_some_activities?)
|
||||
.publiees
|
||||
.map { |procedure| procedure.procedure_overview(start_date) }
|
||||
.select(&:had_some_activities?)
|
||||
|
||||
if active_procedure_overviews.count == 0
|
||||
nil
|
||||
|
@ -124,8 +123,8 @@ class Gestionnaire < ActiveRecord::Base
|
|||
|
||||
messagerie = follow.messagerie_seen_at.present? &&
|
||||
dossier.commentaires
|
||||
.where.not(email: 'contact@tps.apientreprise.fr')
|
||||
.updated_since?(follow.messagerie_seen_at).any?
|
||||
.where.not(email: 'contact@tps.apientreprise.fr')
|
||||
.updated_since?(follow.messagerie_seen_at).any?
|
||||
|
||||
annotations_hash(demande, annotations_privees, avis_notif, messagerie)
|
||||
else
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
class PiecesJustificativesService
|
||||
def self.upload!(dossier, user, params)
|
||||
tpj_contents = dossier.types_de_piece_justificative
|
||||
.map { |tpj| [tpj, params["piece_justificative_#{tpj.id}"]] }
|
||||
.select { |_, content| content.present? }
|
||||
.map { |tpj| [tpj, params["piece_justificative_#{tpj.id}"]] }
|
||||
.select { |_, content| content.present? }
|
||||
|
||||
without_virus, with_virus = tpj_contents
|
||||
.partition { |_, content| ClamavService.safe_file?(content.path) }
|
||||
.partition { |_, content| ClamavService.safe_file?(content.path) }
|
||||
|
||||
errors = with_virus
|
||||
.map { |_, content| content.original_filename + ' : virus détecté' }
|
||||
.map { |_, content| content.original_filename + ' : virus détecté' }
|
||||
|
||||
errors += without_virus
|
||||
.map { |tpj, content| save_pj(content, dossier, tpj, user) }
|
||||
.compact()
|
||||
.map { |tpj, content| save_pj(content, dossier, tpj, user) }
|
||||
.compact()
|
||||
end
|
||||
|
||||
def self.upload_one! dossier, user, params
|
||||
content = params[:piece_justificative][:content]
|
||||
if ClamavService.safe_file? content.path
|
||||
pj = PieceJustificative.new(content: content,
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: nil,
|
||||
user: user)
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: nil,
|
||||
user: user)
|
||||
|
||||
pj.save
|
||||
else
|
||||
|
@ -34,9 +34,9 @@ class PiecesJustificativesService
|
|||
|
||||
def self.save_pj(content, dossier, tpj, user)
|
||||
pj = PieceJustificative.new(content: content,
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: tpj,
|
||||
user: user)
|
||||
dossier: dossier,
|
||||
type_de_piece_justificative: tpj,
|
||||
user: user)
|
||||
|
||||
pj.save ? nil : "le fichier #{content.original_filename} (#{pj.libelle.truncate(200)}) n'a pas pu être sauvegardé"
|
||||
end
|
||||
|
|
|
@ -5,17 +5,17 @@ class TypesDeChampService
|
|||
params_with_ordered_champs = order_champs(params, attributes)
|
||||
|
||||
parameters = params_with_ordered_champs
|
||||
.require(:procedure)
|
||||
.permit("#{attributes}" => [
|
||||
:libelle,
|
||||
:description,
|
||||
:order_place,
|
||||
:type_champ,
|
||||
:id,
|
||||
:mandatory,
|
||||
:type,
|
||||
drop_down_list_attributes: [:value, :id]
|
||||
])
|
||||
.require(:procedure)
|
||||
.permit("#{attributes}" => [
|
||||
:libelle,
|
||||
:description,
|
||||
:order_place,
|
||||
:type_champ,
|
||||
:id,
|
||||
:mandatory,
|
||||
:type,
|
||||
drop_down_list_attributes: [:value, :id]
|
||||
])
|
||||
|
||||
parameters[attributes].each do |param_first, param_second|
|
||||
if param_second[:libelle].empty?
|
||||
|
|
|
@ -45,7 +45,7 @@ describe RootController, type: :controller do
|
|||
|
||||
before do
|
||||
stub_request(:get, "https://api.github.com/repos/betagouv/tps/releases/latest")
|
||||
.to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {})
|
||||
.to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {})
|
||||
|
||||
subject
|
||||
end
|
||||
|
|
|
@ -82,8 +82,8 @@ shared_examples 'carte_controller_spec' do
|
|||
|
||||
before do
|
||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
||||
.to receive(:to_params)
|
||||
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}})
|
||||
.to receive(:to_params)
|
||||
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}})
|
||||
|
||||
post :save, params: {dossier_id: dossier.id, json_latlngs: json_latlngs}
|
||||
end
|
||||
|
@ -129,8 +129,8 @@ shared_examples 'carte_controller_spec' do
|
|||
|
||||
before do
|
||||
allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter)
|
||||
.to receive(:to_params)
|
||||
.and_return([{:surface_intersection => "0.0006", :surface_parcelle => 11252.692583090324, :numero => "0013", :feuille => 1, :section => "CD", :code_dep => "30", :nom_com => "Le Grau-du-Roi", :code_com => "133", :code_arr => "000", :geometry => {:type => "MultiPolygon", :coordinates => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}}])
|
||||
.to receive(:to_params)
|
||||
.and_return([{:surface_intersection => "0.0006", :surface_parcelle => 11252.692583090324, :numero => "0013", :feuille => 1, :section => "CD", :code_dep => "30", :nom_com => "Le Grau-du-Roi", :code_com => "133", :code_arr => "000", :geometry => {:type => "MultiPolygon", :coordinates => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}}])
|
||||
|
||||
post :save, params: {dossier_id: dossier.id, json_latlngs: json_latlngs}
|
||||
end
|
||||
|
@ -184,7 +184,7 @@ shared_examples 'carte_controller_spec' do
|
|||
dossier.update etablissement: nil
|
||||
|
||||
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/)
|
||||
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||
get :get_position, params: {dossier_id: dossier.id}
|
||||
end
|
||||
|
||||
|
@ -202,7 +202,7 @@ shared_examples 'carte_controller_spec' do
|
|||
|
||||
before do
|
||||
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/)
|
||||
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||
get :get_position, params: {dossier_id: dossier.id}
|
||||
end
|
||||
|
||||
|
@ -217,7 +217,7 @@ shared_examples 'carte_controller_spec' do
|
|||
context 'retour d\'un fichier JSON avec 3 attributs' do
|
||||
before do
|
||||
stub_request(:get, "http://api-adresse.data.gouv.fr/search?limit=1&q=#{adresse}")
|
||||
.to_return(status: 200, body: '{"query": "50 avenue des champs u00e9lysu00e9es Paris 75008", "version": "draft", "licence": "ODbL 1.0", "features": [{"geometry": {"coordinates": [2.306888, 48.870374], "type": "Point"}, "type": "Feature", "properties": {"city": "Paris", "label": "50 Avenue des Champs u00c9lysu00e9es 75008 Paris", "housenumber": "50", "id": "ADRNIVX_0000000270748251", "postcode": "75008", "name": "50 Avenue des Champs u00c9lysu00e9es", "citycode": "75108", "context": "75, u00cele-de-France", "score": 0.9054545454545454, "type": "housenumber"}}], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||
.to_return(status: 200, body: '{"query": "50 avenue des champs u00e9lysu00e9es Paris 75008", "version": "draft", "licence": "ODbL 1.0", "features": [{"geometry": {"coordinates": [2.306888, 48.870374], "type": "Point"}, "type": "Feature", "properties": {"city": "Paris", "label": "50 Avenue des Champs u00c9lysu00e9es 75008 Paris", "housenumber": "50", "id": "ADRNIVX_0000000270748251", "postcode": "75008", "name": "50 Avenue des Champs u00c9lysu00e9es", "citycode": "75108", "context": "75, u00cele-de-France", "score": 0.9054545454545454, "type": "housenumber"}}], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||
|
||||
get :get_position, params: {dossier_id: dossier.id}
|
||||
end
|
||||
|
@ -244,8 +244,8 @@ shared_examples 'carte_controller_spec' do
|
|||
describe 'POST #get_qp' do
|
||||
before do
|
||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
||||
.to receive(:to_params)
|
||||
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}})
|
||||
.to receive(:to_params)
|
||||
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}})
|
||||
|
||||
post :get_qp, params: {dossier_id: dossier.id, coordinates: coordinates}
|
||||
end
|
||||
|
|
|
@ -179,19 +179,19 @@ describe Users::DossiersController, type: :controller do
|
|||
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret_not_found}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 404, body: 'fake body')
|
||||
.to_return(status: 404, body: 'fake body')
|
||||
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/etablissement.json'))
|
||||
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/etablissement.json'))
|
||||
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
|
||||
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/entreprise.json'))
|
||||
.to_return(status: status_entreprise_call, body: File.read('spec/support/files/entreprise.json'))
|
||||
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: exercices_status, body: exercices_body)
|
||||
.to_return(status: exercices_status, body: exercices_body)
|
||||
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: rna_status, body: rna_body)
|
||||
.to_return(status: rna_status, body: rna_body)
|
||||
|
||||
dossier
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ feature 'Administrator connection' do
|
|||
context 'when clicking on sign-out' do
|
||||
before do
|
||||
stub_request(:get, "https://api.github.com/repos/betagouv/tps/releases/latest")
|
||||
.to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {})
|
||||
.to_return(:status => 200, :body => '{"tag_name": "plip", "body": "blabla", "published_at": "2016-02-09T16:46:47Z"}', :headers => {})
|
||||
|
||||
page.find_by_id('sign-out').find('a').click
|
||||
end
|
||||
|
|
|
@ -31,14 +31,14 @@ feature 'user path for dossier creation' do
|
|||
context 'sets siret' do
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
|
||||
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
|
||||
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 404, body: '')
|
||||
.to_return(status: 404, body: '')
|
||||
|
||||
page.find_by_id('dossier-siret').set siret
|
||||
page.click_on 'Valider'
|
||||
|
|
|
@ -47,13 +47,13 @@ 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), only_path: true)
|
||||
fill_in 'dossier-siret', with: siret
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 404, body: '')
|
||||
.to_return(status: 404, body: '')
|
||||
page.find_by_id('dossier-siret').set siret
|
||||
page.find_by_id('submit-siret').trigger('click')
|
||||
expect(page).to have_css('#recap-info-entreprise')
|
||||
|
|
|
@ -27,13 +27,13 @@ feature 'user arrive on siret page' do
|
|||
context 'when enter a siret', js: true do
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/etablissement.json'))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/entreprise.json'))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/exercices/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
|
||||
.to_return(status: 200, body: File.read('spec/support/files/exercices.json'))
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/associations/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: 404, body: '')
|
||||
.to_return(status: 404, body: '')
|
||||
|
||||
page.find_by_id('dossier-siret').set siret
|
||||
page.click_on 'Valider'
|
||||
|
|
|
@ -10,7 +10,7 @@ describe Carto::Bano::AddressRetriever do
|
|||
|
||||
before do
|
||||
stub_request(:get, "http://api-adresse.data.gouv.fr/search?&q=#{request}&limit=5")
|
||||
.to_return(status: status, body: response, headers: {})
|
||||
.to_return(status: status, body: response, headers: {})
|
||||
end
|
||||
|
||||
context 'when address return a list of address' do
|
||||
|
|
|
@ -6,9 +6,9 @@ describe CARTO::SGMAP::API do
|
|||
|
||||
before do
|
||||
stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search")
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
context 'when geojson is empty' do
|
||||
let(:geojson) { '' }
|
||||
|
@ -54,9 +54,9 @@ describe CARTO::SGMAP::API do
|
|||
|
||||
before do
|
||||
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
context 'when geojson is empty' do
|
||||
let(:geojson) { '' }
|
||||
|
|
|
@ -5,9 +5,9 @@ describe CARTO::SGMAP::Cadastre::Adapter do
|
|||
|
||||
before do
|
||||
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
|
||||
context 'coordinates are filled' do
|
||||
|
|
|
@ -5,9 +5,9 @@ describe CARTO::SGMAP::QuartiersPrioritaires::Adapter do
|
|||
|
||||
before do
|
||||
stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search")
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
.with(:body => /.*/,
|
||||
:headers => {'Content-Type' => 'application/json'})
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
|
||||
context 'coordinates are filled' do
|
||||
|
|
|
@ -5,7 +5,7 @@ describe SIADE::API do
|
|||
subject { described_class.entreprise(siren) }
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/#{siren}?token=#{SIADETOKEN}")
|
||||
.to_return(status: status, body: body)
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
context 'when siren does not exist' do
|
||||
let(:siren) { '111111111' }
|
||||
|
@ -31,7 +31,7 @@ describe SIADE::API do
|
|||
subject { described_class.etablissement(siret) }
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(status: status, body: body)
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
|
||||
context 'when siret does not exist' do
|
||||
|
@ -58,7 +58,7 @@ describe SIADE::API do
|
|||
describe '.exercices' do
|
||||
before do
|
||||
stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
|
||||
.to_return(status: status, body: body)
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
|
||||
context 'when siret does not exist' do
|
||||
|
@ -89,7 +89,7 @@ describe SIADE::API do
|
|||
describe '.rna' do
|
||||
before do
|
||||
stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/)
|
||||
.to_return(status: status, body: body)
|
||||
.to_return(status: status, body: body)
|
||||
end
|
||||
|
||||
subject { described_class.rna(siren) }
|
||||
|
|
|
@ -5,7 +5,7 @@ describe SIADE::EntrepriseAdapter do
|
|||
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/entreprises/418166096?token=#{SIADETOKEN}")
|
||||
.to_return(body: File.read('spec/support/files/entreprise.json', status: 200))
|
||||
.to_return(body: File.read('spec/support/files/entreprise.json', status: 200))
|
||||
end
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
|
|
|
@ -7,7 +7,7 @@ describe SIADE::EtablissementAdapter do
|
|||
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{siret}?token=#{SIADETOKEN}")
|
||||
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
|
||||
.to_return(body: File.read('spec/support/files/etablissement.json', status: 200))
|
||||
end
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
|
@ -74,7 +74,7 @@ describe SIADE::EtablissementAdapter do
|
|||
|
||||
before do
|
||||
stub_request(:get, "https://staging.entreprise.api.gouv.fr/v2/etablissements/#{bad_siret}?token=#{SIADETOKEN}")
|
||||
.to_return(body: 'Fake body', status: 404)
|
||||
.to_return(body: 'Fake body', status: 404)
|
||||
end
|
||||
|
||||
it { expect(subject).to be_nil }
|
||||
|
|
|
@ -6,7 +6,7 @@ describe SIADE::ExercicesAdapter do
|
|||
|
||||
before do
|
||||
stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/exercices\/.*token=/)
|
||||
.to_return(body: File.read('spec/support/files/exercices.json', status: 200))
|
||||
.to_return(body: File.read('spec/support/files/exercices.json', status: 200))
|
||||
end
|
||||
|
||||
it '#to_params class est une Hash ?' do
|
||||
|
|
|
@ -9,7 +9,7 @@ describe SIADE::RNAAdapter do
|
|||
|
||||
before do
|
||||
stub_request(:get, /https:\/\/staging.entreprise.api.gouv.fr\/v2\/associations\/.*token=/)
|
||||
.to_return(body: body, status: status)
|
||||
.to_return(body: body, status: status)
|
||||
end
|
||||
|
||||
context 'when siret is not valid' do
|
||||
|
|
Loading…
Add table
Reference in a new issue