Revu de code 0
This commit is contained in:
parent
f7dfcfa5a5
commit
d09ac6043c
16 changed files with 886 additions and 404 deletions
|
@ -8,12 +8,12 @@ RSpec.describe CarteController, type: :controller do
|
|||
|
||||
describe "GET #show" do
|
||||
it "returns http success" do
|
||||
get :show, :dossier_id => dossier_id
|
||||
get :show, dossier_id: dossier_id
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'redirection vers start si mauvais dossier ID' do
|
||||
get :show, :dossier_id => bad_dossier_id
|
||||
get :show, dossier_id: bad_dossier_id
|
||||
expect(response).to redirect_to('/start/error_dossier')
|
||||
end
|
||||
end
|
||||
|
@ -29,28 +29,27 @@ RSpec.describe CarteController, type: :controller do
|
|||
context 'En train de modifier la localisation' do
|
||||
before do
|
||||
post :save_ref_api_carto, :dossier_id => dossier_id, :ref_dossier => ref_dossier, :back_url => 'recapitulatif'
|
||||
@last_commentaire_id = ActiveRecord::Base.connection.execute("SELECT currval('commentaires_id_seq')").getvalue(0,0)
|
||||
end
|
||||
|
||||
context 'Enregistrement d\'un commentaire informant la modification' do
|
||||
subject{Commentaire.find(@last_commentaire_id)}
|
||||
context 'Enregistrement d\'un commentaire informant la modification' do
|
||||
subject { Commentaire.last }
|
||||
|
||||
it 'champs email' do
|
||||
expect(subject.email).to eq('Modification localisation')
|
||||
end
|
||||
|
||||
it 'champs body' do
|
||||
expect(subject.body).to eq('La localisation de la demande a été modifiée. Merci de le prendre en compte.')
|
||||
end
|
||||
|
||||
it 'champs dossier' do
|
||||
expect(subject.dossier.id).to eq(dossier_id)
|
||||
end
|
||||
it 'champs email' do
|
||||
expect(subject.email).to eq('Modification localisation')
|
||||
end
|
||||
|
||||
it 'Redirection vers la page récapitulatif' do
|
||||
expect(response).to redirect_to("/dossiers/#{dossier_id}/recapitulatif")
|
||||
it 'champs body' do
|
||||
expect(subject.body).to eq('La localisation de la demande a été modifiée. Merci de le prendre en compte.')
|
||||
end
|
||||
|
||||
it 'champs dossier' do
|
||||
expect(subject.dossier.id).to eq(dossier_id)
|
||||
end
|
||||
end
|
||||
|
||||
it 'Redirection vers la page récapitulatif' do
|
||||
expect(response).to redirect_to("/dossiers/#{dossier_id}/recapitulatif")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -61,6 +60,8 @@ RSpec.describe CarteController, type: :controller do
|
|||
get :get_position, :dossier_id => dossier_id
|
||||
end
|
||||
|
||||
#TODO Test carto geocodeur ne revoit rien / nil
|
||||
|
||||
context 'retour d\'un fichier JSON avec 3 attributs' do
|
||||
subject {JSON.parse(response.body)}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
RSpec.describe CommentairesController, type: :controller do
|
||||
describe CommentairesController, type: :controller do
|
||||
let (:dossier_id){10000}
|
||||
let (:email_commentaire){'test@test.com'}
|
||||
let (:texte_commentaire){'Commentaire de test'}
|
||||
|
|
|
@ -24,13 +24,13 @@ RSpec.describe DossiersController, type: :controller do
|
|||
describe 'POST #create' do
|
||||
before do
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/api/v1/etablissements/#{bad_siret}?token=#{SIADETOKEN}").
|
||||
to_return(:status => 404, :body => 'fake body', :headers => {})
|
||||
to_return(:status => 404, :body => 'fake body')
|
||||
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/api/v1/etablissements/#{siret}?token=#{SIADETOKEN}").
|
||||
to_return(:status => 200, :body => File.read('spec/support/files/etablissement.json'), :headers => {})
|
||||
to_return(:status => 200, :body => File.read('spec/support/files/etablissement.json'))
|
||||
|
||||
stub_request(:get, "https://api-dev.apientreprise.fr/api/v1/entreprises/#{siren}?token=#{SIADETOKEN}").
|
||||
to_return(:status => 200, :body => File.read('spec/support/files/entreprise.json'), :headers => {})
|
||||
to_return(:status => 200, :body => File.read('spec/support/files/entreprise.json'))
|
||||
end
|
||||
|
||||
context 'Le SIRET est correct' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue