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

@ -17,7 +17,7 @@ describe Admin::TracksController do
describe 'GET #index' do
before :each do
get :index, conference_id: conference.short_title
get :index, params: { conference_id: conference.short_title }
end
it 'assigns @tracks with the correct values' do
@ -33,7 +33,7 @@ describe Admin::TracksController do
describe 'GET #show' do
before :each do
get :show, conference_id: conference.short_title, id: track.short_name
get :show, params: { conference_id: conference.short_title, id: track.short_name }
end
it 'assigns the correct track' do
@ -47,7 +47,7 @@ describe Admin::TracksController do
describe 'GET #new' do
before :each do
get :new, conference_id: conference.short_title
get :new, params: { conference_id: conference.short_title }
end
it 'assigns a new track with the correct conference' do
@ -64,7 +64,7 @@ describe Admin::TracksController do
describe 'POST #create' do
context 'saves successfuly' do
before :each do
post :create, track: attributes_for(:track), conference_id: conference.short_title
post :create, params: { track: attributes_for(:track), conference_id: conference.short_title }
end
it 'assigns a new track with the correct conference' do
@ -94,7 +94,7 @@ describe Admin::TracksController do
context 'save fails' do
before :each do
allow_any_instance_of(Track).to receive(:save).and_return(false)
post :create, track: attributes_for(:track, short_name: 'my_track'), conference_id: conference.short_title
post :create, params: { track: attributes_for(:track, short_name: 'my_track'), conference_id: conference.short_title }
end
it 'assigns a new track with the correct conference' do
@ -119,7 +119,7 @@ describe Admin::TracksController do
describe 'GET #edit' do
before :each do
get :edit, conference_id: conference.short_title, id: track.short_name
get :edit, params: { conference_id: conference.short_title, id: track.short_name }
end
it 'assigns the correct track' do
@ -134,9 +134,9 @@ describe Admin::TracksController do
describe 'PATCH #update' do
context 'updates successfully' do
before :each do
patch :update, track: attributes_for(:track, color: '#FF0000'),
conference_id: conference.short_title,
id: track.short_name
patch :update, params: { track: attributes_for(:track, color: '#FF0000'),
conference_id: conference.short_title,
id: track.short_name }
end
it 'assigns the correct track' do
@ -160,9 +160,9 @@ describe Admin::TracksController do
context 'update fails' do
before :each do
allow_any_instance_of(Track).to receive(:save).and_return(false)
patch :update, track: attributes_for(:track, color: '#FF0000'),
conference_id: conference.short_title,
id: track.short_name
patch :update, params: { track: attributes_for(:track, color: '#FF0000'),
conference_id: conference.short_title,
id: track.short_name }
end
it 'assigns the correct track' do
@ -187,7 +187,7 @@ describe Admin::TracksController do
describe 'DELETE #destroy' do
context 'deletes successfully' do
before :each do
delete :destroy, conference_id: conference.short_title, id: track.short_name
delete :destroy, params: { conference_id: conference.short_title, id: track.short_name }
end
it 'redirects to admin tracks index path' do
@ -206,7 +206,7 @@ describe Admin::TracksController do
context 'delete fails' do
before :each do
allow_any_instance_of(Track).to receive(:destroy).and_return(false)
delete :destroy, conference_id: conference.short_title, id: track.short_name
delete :destroy, params: { conference_id: conference.short_title, id: track.short_name }
end
it 'assigns the correct track' do
@ -236,7 +236,7 @@ describe Admin::TracksController do
context 'toggles successfully' do
before :each do
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
self_organized_track.reload
end
@ -256,7 +256,7 @@ describe Admin::TracksController do
context 'save fails' do
before :each do
allow_any_instance_of(Track).to receive(:save).and_return(false)
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
self_organized_track.reload
end
@ -282,7 +282,7 @@ describe Admin::TracksController do
context 'toggles successfully' do
before :each do
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
self_organized_track.reload
end
@ -302,7 +302,7 @@ describe Admin::TracksController do
context 'save fails' do
before :each do
allow_any_instance_of(Track).to receive(:save).and_return(false)
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
self_organized_track.reload
end
@ -325,7 +325,7 @@ describe Admin::TracksController do
before :each do
self_organized_track.state = 'canceled'
self_organized_track.save!
patch :restart, conference_id: conference.short_title, id: self_organized_track.short_name
patch :restart, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
self_organized_track.reload
end
@ -344,7 +344,7 @@ describe Admin::TracksController do
describe 'PATCH #to_accept' do
before :each do
patch :to_accept, conference_id: conference.short_title, id: self_organized_track.short_name
patch :to_accept, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
self_organized_track.reload
end
@ -364,7 +364,7 @@ describe Admin::TracksController do
describe 'PATCH #accept' do
shared_examples 'fails to accept' do
before :each do
patch :accept, conference_id: conference.short_title, id: self_organized_track.short_name
patch :accept, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
end
it 'assigns the correct track' do
@ -382,7 +382,7 @@ describe Admin::TracksController do
context 'has start_date, end_date and room' do
before :each do
patch :accept, conference_id: conference.short_title, id: self_organized_track.short_name
patch :accept, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
self_organized_track.reload
end
@ -472,7 +472,7 @@ describe Admin::TracksController do
before :each do
self_organized_track.state = 'accepted'
self_organized_track.save!
patch :confirm, conference_id: conference.short_title, id: self_organized_track.short_name
patch :confirm, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
self_organized_track.reload
end
@ -491,7 +491,7 @@ describe Admin::TracksController do
describe 'PATCH #to_reject' do
before :each do
patch :to_reject, conference_id: conference.short_title, id: self_organized_track.short_name
patch :to_reject, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
self_organized_track.reload
end
@ -510,7 +510,7 @@ describe Admin::TracksController do
describe 'PATCH #reject' do
before :each do
patch :reject, conference_id: conference.short_title, id: self_organized_track.short_name
patch :reject, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
self_organized_track.reload
end
@ -531,7 +531,7 @@ describe Admin::TracksController do
before :each do
self_organized_track.state = 'confirmed'
self_organized_track.save!
patch :cancel, conference_id: conference.short_title, id: self_organized_track.short_name
patch :cancel, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
self_organized_track.reload
end