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:
parent
b8013661a2
commit
d1180e2767
35 changed files with 975 additions and 364 deletions
|
|
@ -12,7 +12,7 @@ describe Admin::RoomsController do
|
|||
before { sign_in admin }
|
||||
|
||||
describe 'GET #index' do
|
||||
before { get :index, conference_id: conference.short_title }
|
||||
before { get :index, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'assigns conference, venue and rooms variables' do
|
||||
expect(assigns(:conference)).to eq conference
|
||||
|
|
@ -26,7 +26,7 @@ describe Admin::RoomsController do
|
|||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
before { get :edit, conference_id: conference.short_title, id: room.id }
|
||||
before { get :edit, params: { conference_id: conference.short_title, id: room.id } }
|
||||
|
||||
it 'renders edit template' do
|
||||
expect(response).to render_template('edit')
|
||||
|
|
@ -38,7 +38,7 @@ describe Admin::RoomsController do
|
|||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
before { get :new, conference_id: conference.short_title }
|
||||
before { get :new, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'renders new template' do
|
||||
expect(response).to render_template('new')
|
||||
|
|
@ -52,7 +52,7 @@ describe Admin::RoomsController do
|
|||
describe 'POST #create' do
|
||||
context 'saves successfuly' do
|
||||
before do
|
||||
post :create, room: attributes_for(:room), conference_id: conference.short_title
|
||||
post :create, params: { room: attributes_for(:room), conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
|
|
@ -71,7 +71,7 @@ describe Admin::RoomsController do
|
|||
context 'save fails' do
|
||||
before do
|
||||
allow_any_instance_of(Room).to receive(:save).and_return(false)
|
||||
post :create, room: attributes_for(:room), conference_id: conference.short_title
|
||||
post :create, params: { room: attributes_for(:room), conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'renders new template' do
|
||||
|
|
@ -91,9 +91,9 @@ describe Admin::RoomsController do
|
|||
describe 'PATCH #update' do
|
||||
context 'updates successfully' do
|
||||
before do
|
||||
patch :update, room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id
|
||||
patch :update, params: { room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id }
|
||||
end
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
|
|
@ -113,9 +113,9 @@ describe Admin::RoomsController do
|
|||
context 'update fails' do
|
||||
before do
|
||||
allow_any_instance_of(Room).to receive(:save).and_return(false)
|
||||
patch :update, room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id
|
||||
patch :update, params: { room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id }
|
||||
end
|
||||
|
||||
it 'renders edit template' do
|
||||
|
|
@ -135,7 +135,7 @@ describe Admin::RoomsController do
|
|||
|
||||
describe 'DELETE #destroy' do
|
||||
context 'deletes successfully' do
|
||||
before { delete :destroy, conference_id: conference.short_title, id: room.id }
|
||||
before { delete :destroy, params: { conference_id: conference.short_title, id: room.id } }
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
expect(response).to redirect_to admin_conference_venue_rooms_path(conference_id: conference.short_title)
|
||||
|
|
@ -153,7 +153,7 @@ describe Admin::RoomsController do
|
|||
context 'delete fails' do
|
||||
before do
|
||||
allow_any_instance_of(Room).to receive(:destroy).and_return(false)
|
||||
delete :destroy, conference_id: conference.short_title, id: room.id
|
||||
delete :destroy, params: { conference_id: conference.short_title, id: room.id }
|
||||
end
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue