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
|
|
@ -15,7 +15,7 @@ describe 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])
|
||||
|
|
@ -27,7 +27,7 @@ describe 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)
|
||||
|
|
@ -40,7 +40,7 @@ describe 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
|
||||
expect(Booth.count).to_not eq(0)
|
||||
|
|
@ -60,11 +60,11 @@ describe 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
|
||||
|
|
@ -80,7 +80,7 @@ describe 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')
|
||||
|
|
@ -93,7 +93,7 @@ describe 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 booth index path' do
|
||||
expect(response).to redirect_to conference_booths_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue