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,7 +13,7 @@ describe ConferenceRegistrationsController, type: :controller do
before :each do
sign_in send(user) if user
stub_const('ENV', ENV.to_hash.merge('OSEM_ICHAIN_ENABLED' => ichain))
get :new, conference_id: conference.short_title
get :new, params: { conference_id: conference.short_title }
end
it 'redirects' do
@ -29,7 +29,7 @@ describe ConferenceRegistrationsController, type: :controller do
before :each do
sign_in send(user) if user
stub_const('ENV', ENV.to_hash.merge('OSEM_ICHAIN_ENABLED' => ichain))
get :new, conference_id: conference.short_title
get :new, params: { conference_id: conference.short_title }
end
it 'user variable exists' do
@ -231,7 +231,7 @@ describe ConferenceRegistrationsController, type: :controller do
context 'successful request' do
before do
get :show, conference_id: conference.short_title
get :show, params: { conference_id: conference.short_title }
end
it 'assigns variables' do
@ -250,7 +250,7 @@ describe ConferenceRegistrationsController, type: :controller do
@purchased_ticket = create(:ticket_purchase, conference: conference,
user: user,
ticket: @ticket)
get :show, conference_id: conference.short_title
get :show, params: { conference_id: conference.short_title }
end
it 'does not assign price of purchased tickets to total_price and purchased tickets to tickets without payment' do
@ -260,7 +260,7 @@ describe ConferenceRegistrationsController, type: :controller do
context 'user has not purchased any ticket' do
before do
get :show, conference_id: conference.short_title
get :show, params: { conference_id: conference.short_title }
end
it 'assigns 0 dollars to total_price and empty array to tickets variables' do
@ -273,7 +273,7 @@ describe ConferenceRegistrationsController, type: :controller do
describe 'GET #edit' do
before do
@registration = create(:registration, conference: conference, user: user)
get :edit, conference_id: conference.short_title
get :edit, params: { conference_id: conference.short_title }
end
it 'assigns conference and registration variable' do
@ -296,8 +296,8 @@ describe ConferenceRegistrationsController, type: :controller do
context 'updates successfully' do
before do
patch :update, registration: attributes_for(:registration, arrival: Date.new(2014, 04, 29)),
conference_id: conference.short_title
patch :update, params: { registration: attributes_for(:registration, arrival: Date.new(2014, 04, 29)),
conference_id: conference.short_title }
end
it 'redirects to registration show path' do
@ -317,8 +317,8 @@ describe ConferenceRegistrationsController, type: :controller do
context 'update fails' do
before do
allow_any_instance_of(Registration).to receive(:update_attributes).and_return(false)
patch :update, registration: attributes_for(:registration, arrival: Date.new(2014, 04, 27)),
conference_id: conference.short_title
patch :update, params: { registration: attributes_for(:registration, arrival: Date.new(2014, 04, 27)),
conference_id: conference.short_title }
end
it 'renders edit template' do
@ -343,7 +343,7 @@ describe ConferenceRegistrationsController, type: :controller do
context 'deletes successfully' do
before(:each, run: true) do
delete :destroy, conference_id: conference.short_title
delete :destroy, params: { conference_id: conference.short_title }
end
it 'redirects to root path', run: true do
@ -356,7 +356,7 @@ describe ConferenceRegistrationsController, type: :controller do
it 'deletes the registration' do
expect do
delete :destroy, conference_id: conference.short_title
delete :destroy, params: { conference_id: conference.short_title }
end.to change{ Registration.count }.from(2).to(1)
end
end
@ -364,7 +364,7 @@ describe ConferenceRegistrationsController, type: :controller do
context 'delete fails' do
before do
allow_any_instance_of(Registration).to receive(:destroy).and_return(false)
delete :destroy, conference_id: conference.short_title
delete :destroy, params: { conference_id: conference.short_title }
end
it 'redirects to registration show path' do