Add missing params wrapping to some tests

This commit is contained in:
gregoirenovel 2018-01-23 18:16:44 +01:00
parent 75c8c7c0b3
commit 5b706cc7d4
5 changed files with 17 additions and 13 deletions

View file

@ -16,10 +16,11 @@ describe Admin::GestionnairesController, type: :controller do
describe 'GET #index with sorting and pagination' do
subject {
get :index,
get :index, params: {
'gestionnaires_smart_listing[page]': 1,
'gestionnaires_smart_listing[per_page]': 10,
'gestionnaires_smart_listing[sort][email]': 'asc'
}
}
it { expect(subject.status).to eq(200) }

View file

@ -44,10 +44,11 @@ describe Admin::ProceduresController, type: :controller do
describe 'GET #index with sorting and pagination' do
subject {
get :index,
get :index, params: {
'procedures_smart_listing[page]': 1,
'procedures_smart_listing[per_page]': 10,
'procedures_smart_listing[sort][id]': 'asc'
}
}
it { expect(subject.status).to eq(200) }
@ -61,10 +62,11 @@ describe Admin::ProceduresController, type: :controller do
describe 'GET #archived with sorting and pagination' do
subject {
get :archived,
get :archived, params: {
'procedures_smart_listing[page]': 1,
'procedures_smart_listing[per_page]': 10,
'procedures_smart_listing[sort][libelle]': 'asc'
}
}
it { expect(subject.status).to eq(200) }
@ -78,10 +80,11 @@ describe Admin::ProceduresController, type: :controller do
describe 'GET #draft with sorting and pagination' do
subject {
get :draft,
get :draft, params: {
'procedures_smart_listing[page]': 1,
'procedures_smart_listing[per_page]': 10,
'procedures_smart_listing[sort][published_at]': 'asc'
}
}
it { expect(subject.status).to eq(200) }

View file

@ -9,7 +9,7 @@ describe Manager::AdministrateursController, type: :controller do
sign_in administration
end
subject { post :create, administrateur: { email: email } }
subject { post :create, params: { administrateur: { email: email } } }
context 'when email and password are correct' do
it 'add new administrateur in database' do

View file

@ -5,7 +5,7 @@ describe Manager::ProceduresController, type: :controller do
before do
sign_in administration
post :whitelist, id: procedure.id
post :whitelist, params: { id: procedure.id }
procedure.reload
end

View file

@ -22,14 +22,14 @@ describe NewGestionnaire::AvisController, type: :controller do
it { expect(assigns(:statut)).to eq('a-donner') }
context 'with a statut equal to donnes' do
before { get :index, statut: 'donnes' }
before { get :index, params: { statut: 'donnes' } }
it { expect(assigns(:statut)).to eq('donnes') }
end
end
describe '#show' do
before { get :show, { id: avis_without_answer.id } }
before { get :show, params: { id: avis_without_answer.id } }
it { expect(response).to have_http_status(:success) }
it { expect(assigns(:avis)).to eq(avis_without_answer) }
@ -37,7 +37,7 @@ describe NewGestionnaire::AvisController, type: :controller do
end
describe '#instruction' do
before { get :instruction, { id: avis_without_answer.id } }
before { get :instruction, params: { id: avis_without_answer.id } }
it { expect(response).to have_http_status(:success) }
it { expect(assigns(:avis)).to eq(avis_without_answer) }
@ -45,7 +45,7 @@ describe NewGestionnaire::AvisController, type: :controller do
end
describe '#messagerie' do
before { get :messagerie, { id: avis_without_answer.id } }
before { get :messagerie, params: { id: avis_without_answer.id } }
it { expect(response).to have_http_status(:success) }
it { expect(assigns(:avis)).to eq(avis_without_answer) }
@ -54,7 +54,7 @@ describe NewGestionnaire::AvisController, type: :controller do
describe '#update' do
before do
patch :update, { id: avis_without_answer.id, avis: { answer: 'answer' } }
patch :update, params: { id: avis_without_answer.id, avis: { answer: 'answer' } }
avis_without_answer.reload
end
@ -67,7 +67,7 @@ describe NewGestionnaire::AvisController, type: :controller do
let(:file) { nil }
let(:scan_result) { true }
subject { post :create_commentaire, { id: avis_without_answer.id, commentaire: { body: 'commentaire body', file: file } } }
subject { post :create_commentaire, params: { id: avis_without_answer.id, commentaire: { body: 'commentaire body', file: file } } }
before do
allow(ClamavService).to receive(:safe_file?).and_return(scan_result)
@ -105,7 +105,7 @@ describe NewGestionnaire::AvisController, type: :controller do
let(:created_avis) { Avis.last }
before do
post :create_avis, { id: previous_avis.id, avis: { email: email, introduction: intro, confidentiel: asked_confidentiel } }
post :create_avis, params: { id: previous_avis.id, avis: { email: email, introduction: intro, confidentiel: asked_confidentiel } }
end
context 'when the previous avis is public' do