Use keyword arguments in tests

Raisl 5.1 removes support for non-keyword arguments in `#process`,
`#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head` for the
`ActionDispatch::IntegrationTest` and `ActionController::TestCase`
classes. This means we have to add `params` everywhere in the controller
tests.
This commit is contained in:
Ana María Martínez Gómez 2019-05-13 17:42:09 +02:00
parent b8013661a2
commit d1180e2767
No known key found for this signature in database
GPG key ID: EACB9B4BC80C0347
35 changed files with 975 additions and 364 deletions

View file

@ -13,14 +13,14 @@ describe Admin::BoothsController do
describe 'GET index' do
it 'does not render admin/booths#index' do
get :index, conference_id: conference.short_title
get :index, params: { conference_id: conference.short_title }
expect(response).to redirect_to(user_session_path)
end
end
describe 'GET show' do
it 'does not render admin/booths#show' do
get :show, id: booth.id, conference_id: conference.short_title
get :show, params: { id: booth.id, conference_id: conference.short_title }
expect(response).to redirect_to(user_session_path)
end
end
@ -32,7 +32,7 @@ describe Admin::BoothsController do
end
describe 'GET index' do
before { get :index, conference_id: conference.short_title }
before { get :index, params: { conference_id: conference.short_title } }
it 'assigns attributes for booths' do
expect(assigns(:booths)).to eq([booth])
@ -44,7 +44,7 @@ describe Admin::BoothsController do
end
describe 'GET new' do
before { get :new, conference_id: conference.short_title }
before { get :new, params: { conference_id: conference.short_title } }
it 'assigns attributes for booths' do
expect(assigns(:booth)).to be_a_new(Booth)
@ -57,11 +57,11 @@ describe Admin::BoothsController do
describe 'POST #create' do
context 'successfully created' do
before { post :create, booth: attributes_for(:booth), conference_id: conference.short_title }
before { post :create, params: { booth: attributes_for(:booth), conference_id: conference.short_title } }
it 'creates a new booth' do
expected = expect do
post :create, booth: attributes_for(:booth), conference_id: conference.short_title
post :create, params: { booth: attributes_for(:booth), conference_id: conference.short_title }
end
expected.to change { Booth.count }.by(1)
end
@ -80,11 +80,11 @@ describe Admin::BoothsController do
end
context 'create action fails' do
before { post :create, booth: attributes_for(:booth, title: ''), conference_id: conference.short_title }
before { post :create, params: { booth: attributes_for(:booth, title: ''), conference_id: conference.short_title } }
it 'does not create any record' do
expected = expect do
post :create, booth: attributes_for(:booth, title: ''), conference_id: conference.short_title
post :create, params: { booth: attributes_for(:booth, title: ''), conference_id: conference.short_title }
end
expected.to_not change(Booth, :count)
end
@ -100,7 +100,7 @@ describe Admin::BoothsController do
end
describe 'GET #edit' do
before { get :edit, id: booth.id, conference_id: conference.short_title }
before { get :edit, params: { id: booth.id, conference_id: conference.short_title } }
it 'renders edit template' do
expect(response).to render_template('edit')
@ -113,7 +113,7 @@ describe Admin::BoothsController do
describe 'PATCH #update' do
context 'updates suchessfully' do
before { patch :update, id: booth.id, booth: attributes_for(:booth, title: 'different'), conference_id: conference.short_title }
before { patch :update, params: { id: booth.id, booth: attributes_for(:booth, title: 'different'), conference_id: conference.short_title } }
it 'redirects to admin booth index path' do
expect(response).to redirect_to admin_conference_booths_path
end