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

@ -18,13 +18,13 @@ describe Admin::TicketScanningsController do
describe 'POST #create' do
it 'does not create new ticket scanning' do
expected = expect do
post :create, physical_ticket_id: physical_ticket.token
post :create, params: { physical_ticket_id: physical_ticket.token }
end
expected.to_not change(TicketScanning, :count)
end
it 'redirects to root' do
post :create, physical_ticket_id: physical_ticket.token
post :create, params: { physical_ticket_id: physical_ticket.token }
expect(flash[:alert]).to eq('You are not authorized to access this page.')
expect(response).to redirect_to(root_path)
end
@ -39,13 +39,13 @@ describe Admin::TicketScanningsController do
context 'with valid physical_ticket' do
it 'creates new ticket scanning' do
expected = expect do
post :create, physical_ticket_id: physical_ticket.token
post :create, params: { physical_ticket_id: physical_ticket.token }
end
expected.to change { TicketScanning.count }.by(1)
end
it 'redirects to index' do
post :create, physical_ticket_id: physical_ticket.token
post :create, params: { physical_ticket_id: physical_ticket.token }
expect(flash[:notice]).to eq("Ticket with token #{physical_ticket.token} successfully scanned.")
expect(response).to redirect_to(conferences_path)
end
@ -54,7 +54,7 @@ describe Admin::TicketScanningsController do
context 'with Invalid physical_ticket' do
it 'raises exception' do
expected = expect do
post :create, physical_ticket_id: 'XXXX'
post :create, params: { physical_ticket_id: 'XXXX' }
end
expected.to raise_exception(ActiveRecord::RecordNotFound)
end