Fix major .DEPRECATION WARNING for spec/controllers/users/*.rb

This commit is contained in:
Xavier J 2016-11-15 05:54:27 +01:00
parent cea85f2d49
commit be62dea0e0
9 changed files with 98 additions and 100 deletions

View file

@ -7,10 +7,10 @@ shared_examples 'carte_controller_spec' do
dossier.state = 'validated'
dossier.save
get :show, dossier_id: dossier.id
get :show, params: {dossier_id: dossier.id}
end
it { is_expected.to redirect_to root_path}
it { is_expected.to redirect_to root_path }
end
end
@ -18,7 +18,7 @@ shared_examples 'carte_controller_spec' do
let(:dossier) { create(:dossier) }
before do
get :show, dossier_id: dossier.id
get :show, params: {dossier_id: dossier.id}
end
it { is_expected.to redirect_to(root_path) }
@ -31,26 +31,26 @@ shared_examples 'carte_controller_spec' do
end
it 'redirects to users/sign_in' do
get :show, dossier_id: dossier.id
get :show, params: {dossier_id: dossier.id}
expect(response).to redirect_to('/users/sign_in')
end
end
it 'returns http success if carto is activated' do
get :show, dossier_id: dossier.id
get :show, params: {dossier_id: dossier.id}
expect(response).to have_http_status(:success)
end
context 'when procedure not have activate api carto' do
it 'redirection on user dossier list' do
get :show, dossier_id: dossier_with_no_carto.id
get :show, params: {dossier_id: dossier_with_no_carto.id}
expect(response).to redirect_to(root_path)
end
end
context 'when dossier id not exist' do
it 'redirection on user dossier list' do
get :show, dossier_id: bad_dossier_id
get :show, params: {dossier_id: bad_dossier_id}
expect(response).to redirect_to(root_path)
end
end
@ -61,7 +61,7 @@ shared_examples 'carte_controller_spec' do
describe 'POST #save' do
context 'Aucune localisation n\'a jamais été enregistrée' do
it do
post :save, dossier_id: dossier.id, json_latlngs: ''
post :save, params: {dossier_id: dossier.id, json_latlngs: ''}
expect(response).to redirect_to("/users/dossiers/#{dossier.id}/description")
end
end
@ -69,7 +69,7 @@ shared_examples 'carte_controller_spec' do
context 'En train de modifier la localisation' do
let(:dossier) { create(:dossier, state: 'initiated') }
before do
post :save, dossier_id: dossier.id, json_latlngs: ''
post :save, params: {dossier_id: dossier.id, json_latlngs: ''}
end
it 'Redirection vers la page récapitulatif' do
@ -85,7 +85,7 @@ shared_examples 'carte_controller_spec' do
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, dossier_id: dossier.id, json_latlngs: json_latlngs
post :save, params: {dossier_id: dossier.id, json_latlngs: json_latlngs}
end
context 'when json_latlngs params is empty' do
@ -132,7 +132,7 @@ shared_examples 'carte_controller_spec' do
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, dossier_id: dossier.id, json_latlngs: json_latlngs
post :save, params: {dossier_id: dossier.id, json_latlngs: json_latlngs}
end
context 'when json_latlngs params is empty' do
@ -186,7 +186,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: {})
get :get_position, dossier_id: dossier.id
get :get_position, params: {dossier_id: dossier.id}
end
subject { JSON.parse(response.body) }
@ -202,7 +202,7 @@ shared_examples 'carte_controller_spec' 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: {})
get :get_position, dossier_id: dossier.id
get :get_position, params: {dossier_id: dossier.id}
end
subject { JSON.parse(response.body) }
@ -230,7 +230,7 @@ shared_examples 'carte_controller_spec' do
to receive(:to_params).
and_return({"QPCODE1234" => {:code => "QPCODE1234", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}})
post :get_qp, dossier_id: dossier.id, coordinates: coordinates
post :get_qp, params: {dossier_id: dossier.id, coordinates: coordinates}
end
context 'when coordinates are empty' do

View file

@ -14,7 +14,7 @@ describe Users::CommentairesController, type: :controller do
context 'création correct d\'un commentaire' do
subject do
sign_in dossier.user
post :create, dossier_id: dossier_id, texte_commentaire: texte_commentaire
post :create, params: {dossier_id: dossier_id, texte_commentaire: texte_commentaire}
end
it 'depuis la page récapitulatif' do
@ -30,12 +30,12 @@ describe Users::CommentairesController, type: :controller do
end
end
context 'when document is upload whith a commentaire', vcr: { cassette_name: 'controllers_sers_commentaires_controller_upload_doc' } do
context 'when document is upload whith a commentaire', vcr: {cassette_name: 'controllers_sers_commentaires_controller_upload_doc'} do
let(:document_upload) { Rack::Test::UploadedFile.new("./spec/support/files/piece_justificative_0.pdf", 'application/pdf') }
subject do
sign_in dossier.user
post :create, dossier_id: dossier_id, texte_commentaire: texte_commentaire, piece_justificative: {content: document_upload}
post :create, params: {dossier_id: dossier_id, texte_commentaire: texte_commentaire, piece_justificative: {content: document_upload}}
end
it 'create a new piece justificative' do
@ -84,7 +84,7 @@ describe Users::CommentairesController, type: :controller do
sign_in dossier.user
dossier.replied!
post :create, dossier_id: dossier_id, texte_commentaire: texte_commentaire
post :create, params: {dossier_id: dossier_id, texte_commentaire: texte_commentaire}
dossier.reload
end

View file

@ -9,7 +9,7 @@ shared_examples 'description_controller_spec' do
end
it 'redirects to users/sign_in' do
get :show, dossier_id: dossier_id
get :show, params: {dossier_id: dossier_id}
expect(response).to redirect_to('/users/sign_in')
end
end
@ -20,13 +20,13 @@ shared_examples 'description_controller_spec' do
end
it 'returns http success' do
get :show, dossier_id: dossier_id
get :show, params: {dossier_id: dossier_id}
expect(response).to have_http_status(:success)
end
end
it 'redirection vers start si mauvais dossier ID' do
get :show, dossier_id: bad_dossier_id
get :show, params: {dossier_id: bad_dossier_id}
expect(response).to redirect_to(root_path)
end
@ -38,7 +38,7 @@ shared_examples 'description_controller_spec' do
dossier.state = 'validated'
dossier.save
get :show, dossier_id: dossier.id
get :show, params: {dossier_id: dossier.id}
end
it { is_expected.to redirect_to root_path }
@ -46,7 +46,7 @@ shared_examples 'description_controller_spec' do
end
describe 'before action check_autorisation_donnees' do
subject { get :show, dossier_id: dossier_id }
subject { get :show, params: {dossier_id: dossier_id} }
context 'when dossier does not have a valid autorisations_donness (nil)' do
before do
@ -66,7 +66,7 @@ shared_examples 'description_controller_spec' do
end
describe 'before action check_starter_dossier_informations' do
subject { get :show, dossier_id: dossier_id }
subject { get :show, params: {dossier_id: dossier_id} }
context 'when dossier does not have an enterprise datas' do
before do
@ -96,7 +96,7 @@ shared_examples 'description_controller_spec' do
describe 'Premier enregistrement des données' do
let(:submit) { {nouveaux: 'nouveaux'} }
subject { post :create, dossier_id: dossier_id, submit: submit }
subject { post :create, params: {dossier_id: dossier_id, submit: submit} }
before do
dossier.draft!
@ -128,7 +128,7 @@ shared_examples 'description_controller_spec' do
context 'En train de manipuler un dossier non brouillon' do
before do
dossier.initiated!
post :create, dossier_id: dossier_id
post :create, params: {dossier_id: dossier_id}
dossier.reload
end
@ -145,8 +145,8 @@ shared_examples 'description_controller_spec' do
context 'Quand la procédure accepte les CERFA' do
context 'Sauvegarde du CERFA PDF', vcr: {cassette_name: 'controllers_users_description_controller_save_cerfa'} do
before do
post :create, dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf
post :create, params: {dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf}
dossier.reload
end
@ -172,7 +172,7 @@ shared_examples 'description_controller_spec' do
let(:cerfas) { Cerfa.where(dossier_id: dossier_id) }
before do
post :create, dossier_id: dossier_id, cerfa_pdf: cerfa_pdf
post :create, params: {dossier_id: dossier_id, cerfa_pdf: cerfa_pdf}
end
it "il y a deux CERFA PDF pour ce dossier" do
@ -186,8 +186,8 @@ shared_examples 'description_controller_spec' do
context 'Sauvegarde du CERFA PDF' do
let!(:procedure) { create(:procedure) }
before do
post :create, dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf
post :create, params: {dossier_id: dossier_id,
cerfa_pdf: cerfa_pdf}
dossier.reload
end
@ -205,17 +205,17 @@ shared_examples 'description_controller_spec' do
let(:dossier_minute_value) { '00' }
before do
post :create, {dossier_id: dossier_id,
champs: {
"'#{dossier.champs.first.id}'" => dossier_champs_first,
"'#{dossier.champs.second.id}'" => dossier_date_value
},
time_hour: {
"'#{dossier.champs.second.id}'" => dossier_hour_value,
},
time_minute: {
"'#{dossier.champs.second.id}'" => dossier_minute_value,
}
post :create, params: {dossier_id: dossier_id,
champs: {
"'#{dossier.champs.first.id}'" => dossier_champs_first,
"'#{dossier.champs.second.id}'" => dossier_date_value
},
time_hour: {
"'#{dossier.champs.second.id}'" => dossier_hour_value,
},
time_minute: {
"'#{dossier.champs.second.id}'" => dossier_minute_value,
}
}
dossier.reload
end
@ -245,9 +245,9 @@ shared_examples 'description_controller_spec' do
context 'Sauvegarde des pièces justificatives', vcr: {cassette_name: 'controllers_users_description_controller_sauvegarde_pj'} do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
before do
post :create, {dossier_id: dossier_id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
post :create, params: {dossier_id: dossier_id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
dossier.reload
end
@ -255,9 +255,9 @@ shared_examples 'description_controller_spec' do
it 'ClamavService safe_file? is call' do
expect(ClamavService).to receive(:safe_file?).twice
post :create, {dossier_id: dossier_id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
post :create, params: {dossier_id: dossier_id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1}
end
end
@ -277,9 +277,9 @@ shared_examples 'description_controller_spec' do
describe 'POST #pieces_justificatives', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
subject { patch :pieces_justificatives, {dossier_id: dossier.id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} }
subject { patch :pieces_justificatives, params: {dossier_id: dossier.id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} }
context 'when user is a guest' do
let(:guest) { create :user }
@ -348,9 +348,9 @@ end
shared_examples 'description_controller_spec_POST_piece_justificatives_for_owner' do
let(:all_pj_type) { dossier.procedure.type_de_piece_justificative_ids }
subject { patch :pieces_justificatives, {dossier_id: dossier.id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} }
subject { patch :pieces_justificatives, params: {dossier_id: dossier.id,
'piece_justificative_'+all_pj_type[0].to_s => piece_justificative_0,
'piece_justificative_'+all_pj_type[1].to_s => piece_justificative_1} }
context 'when user is the owner', vcr: {cassette_name: 'controllers_users_description_controller_pieces_justificatives'} do
before do

View file

@ -27,12 +27,12 @@ describe Users::DossiersController, type: :controller do
sign_in dossier.user
end
it 'returns http success with dossier_id valid' do
get :show, id: dossier_id
get :show, params: {id: dossier_id}
expect(response).to have_http_status(:success)
end
it 'redirection vers liste dossier si mauvais dossier ID' do
get :show, id: siret_not_found
get :show, params: {id: siret_not_found}
expect(response).to redirect_to root_path
end
@ -42,7 +42,7 @@ describe Users::DossiersController, type: :controller do
dossier.state = 'validated'
dossier.save
get :show, id: dossier.id
get :show, params: {id: dossier.id}
end
it { is_expected.to redirect_to root_path }
@ -51,7 +51,7 @@ describe Users::DossiersController, type: :controller do
end
describe 'GET #new' do
subject { get :new, procedure_id: procedure_id }
subject { get :new, params: {procedure_id: procedure_id} }
context 'when params procedure_id is present' do
context 'when procedure_id is valid' do
@ -69,7 +69,7 @@ describe Users::DossiersController, type: :controller do
context 'when user have not a saved siret' do
context 'when siret is present on request' do
subject { get :new, procedure_id: procedure_id, siret: siret }
subject { get :new, params: {procedure_id: procedure_id, siret: siret} }
before do
subject
@ -97,7 +97,7 @@ describe Users::DossiersController, type: :controller do
end
context 'when siret is present on request' do
subject { get :new, procedure_id: procedure_id, siret: siret }
subject { get :new, params: {procedure_id: procedure_id, siret: siret} }
before do
subject
@ -153,7 +153,7 @@ describe Users::DossiersController, type: :controller do
end
describe 'GET #commencer' do
subject { get :commencer, procedure_path: procedure.path }
subject { get :commencer, params: {procedure_path: procedure.path} }
it { expect(subject.status).to eq 302 }
it { expect(subject).to redirect_to new_users_dossier_path(procedure_id: procedure.id) }
@ -198,7 +198,7 @@ describe Users::DossiersController, type: :controller do
sign_in user
end
subject { post :siret_informations, dossier_id: dossier.id, dossier: {siret: example_siret} }
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: example_siret}} }
it 'create a dossier' do
expect { subject }.to change { Dossier.count }.by(0)
@ -322,7 +322,7 @@ describe Users::DossiersController, type: :controller do
end
let(:siret_not_found) { '11111111111111' }
subject { post :siret_informations, dossier_id: dossier.id, dossier: {siret: siret_not_found} }
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: siret_not_found}} }
it 'does not create new dossier' do
expect { subject }.not_to change { Dossier.count }
@ -337,7 +337,7 @@ describe Users::DossiersController, type: :controller do
context 'when REST error 400 is return' do
let(:status_entreprise_call) { 400 }
subject { post :siret_informations, dossier_id: dossier.id, dossier: {siret: siret} }
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: siret}} }
before do
sign_in user
@ -350,7 +350,7 @@ describe Users::DossiersController, type: :controller do
end
describe 'PUT #update' do
subject { put :update, id: dossier_id, dossier: {id: dossier_id, autorisation_donnees: autorisation_donnees} }
subject { put :update, params: {id: dossier_id, dossier: {id: dossier_id, autorisation_donnees: autorisation_donnees}} }
before do
sign_in dossier.user
@ -399,11 +399,11 @@ describe Users::DossiersController, type: :controller do
end
describe 'DELETE #destroy' do
let(:user) { create(:user) }
let!(:dossier_draft) { create :dossier, state: "draft", user: user }
let(:user) { create(:user) }
let!(:dossier_draft) { create :dossier, state: "draft", user: user }
let!(:dossier_not_draft) { create :dossier, state: "initiated", user: user }
subject { delete :destroy, id: dossier.id }
subject { delete :destroy, params: {id: dossier.id} }
before do
sign_in user
@ -441,7 +441,7 @@ describe Users::DossiersController, type: :controller do
describe 'PUT #change_siret' do
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
subject { put :change_siret, dossier_id: dossier.id }
subject { put :change_siret, params: {dossier_id: dossier.id} }
before do
sign_in user
@ -462,7 +462,7 @@ describe Users::DossiersController, type: :controller do
end
it 'returns http success' do
get :index, liste: :a_traiter
get :index, params: {liste: :a_traiter}
expect(response).to have_http_status(200)
end
end
@ -475,7 +475,7 @@ describe Users::DossiersController, type: :controller do
end
it 'returns http success' do
get :index, liste: :valides
get :index, params: {liste: :valides}
expect(response).to have_http_status(200)
end
end
@ -488,7 +488,7 @@ describe Users::DossiersController, type: :controller do
end
it 'returns http success' do
get :index, liste: :en_instruction
get :index, params: {liste: :en_instruction}
expect(response).to have_http_status(200)
end
end
@ -501,7 +501,7 @@ describe Users::DossiersController, type: :controller do
end
it 'returns http success' do
get :index, liste: :brouillon
get :index, params: {liste: :brouillon}
expect(response).to have_http_status(200)
end
end
@ -514,7 +514,7 @@ describe Users::DossiersController, type: :controller do
end
it 'returns http success' do
get :index, liste: :termine
get :index, params: {liste: :termine}
expect(response).to have_http_status(200)
end
end
@ -527,7 +527,7 @@ describe Users::DossiersController, type: :controller do
end
it 'returns http success' do
get :index, liste: :invite
get :index, params: {liste: :invite}
expect(response).to have_http_status(200)
end
end
@ -540,7 +540,7 @@ describe Users::DossiersController, type: :controller do
end
it 'returns http success' do
get :index, liste: :list_fake
get :index, params: {liste: :list_fake}
expect(response).to redirect_to(users_dossiers_path)
end
end

View file

@ -17,11 +17,11 @@ describe Users::PasswordsController, type: :controller do
end
it "also signs gestionnaire in" do
put :update, user: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
}
put :update, params: {user: {
reset_password_token: @token,
password: "supersecret",
password_confirmation: "supersecret",
}}
expect(subject.current_user).to eq(user)
expect(subject.current_gestionnaire).to eq(gestionnaire)
end

View file

@ -10,12 +10,12 @@ describe Users::RecapitulatifController, type: :controller do
describe 'GET #show' do
it 'returns http success' do
get :show, dossier_id: dossier.id
get :show, params: {dossier_id: dossier.id}
expect(response).to have_http_status(:success)
end
it 'redirection vers siret si mauvais dossier ID' do
get :show, dossier_id: bad_dossier_id
get :show, params: {dossier_id: bad_dossier_id}
expect(response).to redirect_to('/')
end
@ -27,7 +27,7 @@ describe Users::RecapitulatifController, type: :controller do
dossier.state = 'draft'
dossier.save
get :show, dossier_id: dossier.id
get :show, params: {dossier_id: dossier.id}
end
it { is_expected.to redirect_to root_path }
@ -39,7 +39,7 @@ describe Users::RecapitulatifController, type: :controller do
describe 'POST #initiate' do
context 'when an user initiate his dossier' do
before do
post :initiate, dossier_id: dossier.id
post :initiate, params: {dossier_id: dossier.id}
end
it 'dossier change his state for closed' do
@ -59,7 +59,7 @@ describe Users::RecapitulatifController, type: :controller do
before do
dossier.validated!
Timecop.freeze(deposit_datetime) { post :submit, dossier_id: dossier.id }
Timecop.freeze(deposit_datetime) { post :submit, params: {dossier_id: dossier.id} }
dossier.reload
end
@ -80,10 +80,8 @@ describe Users::RecapitulatifController, type: :controller do
expect(NotificationMailer).to receive(:deliver_now!)
dossier.validated!
post :submit, dossier_id: dossier.id
post :submit, params: {dossier_id: dossier.id}
end
end
end
end

View file

@ -12,7 +12,7 @@ describe Users::RegistrationsController, type: :controller do
end
describe '.create' do
subject { post :create, user: user }
subject { post :create, params: {user: user }}
context 'when user is correct' do
it { expect(described_class).to be < Devise::RegistrationsController }

View file

@ -25,7 +25,7 @@ describe Users::SessionsController, type: :controller do
describe 'France Connect attribut' do
before do
post :create, user: {email: user.email, password: user.password}
post :create, params: {user: {email: user.email, password: user.password}}
user.reload
end
@ -40,7 +40,7 @@ describe Users::SessionsController, type: :controller do
before { allow(Features).to receive(:unified_login).and_return(true) }
it 'signs user in' do
post :create, user: { email: user.email, password: user.password }
post :create, params: {user: {email: user.email, password: user.password}}
expect(@response.redirect?).to be(true)
expect(subject.current_user).to eq(user)
expect(subject.current_gestionnaire).to be(nil)
@ -48,14 +48,14 @@ describe Users::SessionsController, type: :controller do
end
it 'signs gestionnaire in' do
post :create, user: { email: gestionnaire.email, password: gestionnaire.password }
post :create, params: {user: {email: gestionnaire.email, password: gestionnaire.password}}
expect(@response.redirect?).to be(true)
expect(subject.current_user).to be(nil)
expect(subject.current_gestionnaire).to eq(gestionnaire)
end
it 'signs user + gestionnaire in' do
post :create, user: { email: user.email, password: gestionnaire.password }
post :create, params: {user: {email: user.email, password: gestionnaire.password}}
expect(@response.redirect?).to be(true)
expect(subject.current_user).to eq(user)
expect(subject.current_gestionnaire).to eq(gestionnaire)
@ -63,7 +63,7 @@ describe Users::SessionsController, type: :controller do
end
it 'fails to sign in with bad credentials' do
post :create, user: { email: user.email, password: 'wrong_password' }
post :create, params: {user: {email: user.email, password: 'wrong_password'}}
expect(@response.unauthorized?).to be(true)
expect(subject.current_user).to be(nil)
expect(subject.current_gestionnaire).to be(nil)
@ -143,7 +143,7 @@ describe Users::SessionsController, type: :controller do
subject { get :new }
context 'when procedure_id is not present in user_return_to session params' do
it { expect(subject.status).to eq 200}
it { expect(subject.status).to eq 200 }
end
context 'when procedure_id is present in user_return_to session params' do
@ -152,7 +152,7 @@ describe Users::SessionsController, type: :controller do
session["user_return_to"] = '?procedure_id=0'
end
it { expect(subject.status).to eq 302}
it { expect(subject.status).to eq 302 }
it { expect(subject).to redirect_to root_path }
end
@ -162,7 +162,7 @@ describe Users::SessionsController, type: :controller do
session["user_return_to"] = "?procedure_id=#{procedure.id}"
end
it { expect(subject.status).to eq 302}
it { expect(subject.status).to eq 302 }
it { expect(subject).to redirect_to root_path }
end
@ -173,7 +173,7 @@ describe Users::SessionsController, type: :controller do
session["user_return_to"] = "?procedure_id=#{procedure.id}"
end
it { expect(subject.status).to eq 200}
it { expect(subject.status).to eq 200 }
end
end
end

View file

@ -4,7 +4,7 @@ RSpec.shared_examples 'not owner of dossier' do |controller, redirect|
let(:dossier_2) { create(:dossier) }
before do
get controller, dossier_id: dossier_2.id
get controller, params:{dossier_id: dossier_2.id}
end
it 'redirect to home page' do