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

View file

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

View file

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

View file

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

View file

@ -22,14 +22,14 @@ describe NewGestionnaire::AvisController, type: :controller do
it { expect(assigns(:statut)).to eq('a-donner') } it { expect(assigns(:statut)).to eq('a-donner') }
context 'with a statut equal to donnes' do 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') } it { expect(assigns(:statut)).to eq('donnes') }
end end
end end
describe '#show' do 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(response).to have_http_status(:success) }
it { expect(assigns(:avis)).to eq(avis_without_answer) } it { expect(assigns(:avis)).to eq(avis_without_answer) }
@ -37,7 +37,7 @@ describe NewGestionnaire::AvisController, type: :controller do
end end
describe '#instruction' do 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(response).to have_http_status(:success) }
it { expect(assigns(:avis)).to eq(avis_without_answer) } it { expect(assigns(:avis)).to eq(avis_without_answer) }
@ -45,7 +45,7 @@ describe NewGestionnaire::AvisController, type: :controller do
end end
describe '#messagerie' do 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(response).to have_http_status(:success) }
it { expect(assigns(:avis)).to eq(avis_without_answer) } it { expect(assigns(:avis)).to eq(avis_without_answer) }
@ -54,7 +54,7 @@ describe NewGestionnaire::AvisController, type: :controller do
describe '#update' do describe '#update' do
before 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 avis_without_answer.reload
end end
@ -67,7 +67,7 @@ describe NewGestionnaire::AvisController, type: :controller do
let(:file) { nil } let(:file) { nil }
let(:scan_result) { true } 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 before do
allow(ClamavService).to receive(:safe_file?).and_return(scan_result) 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 } let(:created_avis) { Avis.last }
before do 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 end
context 'when the previous avis is public' do context 'when the previous avis is public' do