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

@ -19,12 +19,12 @@ describe Admin::EventSchedulesController do
describe 'POST #create' do
context 'with valid attributes' do
let(:create_action) do
post :create, conference_id: conference.short_title, event_schedule:
post :create, params: { conference_id: conference.short_title, event_schedule:
attributes_for(:event_schedule,
schedule_id: schedule.id,
event_id: create(:event, program: conference.program).id,
room_id: create(:room, venue: venue).id,
start_time: conference.start_date + conference.start_hour.hours)
start_time: conference.start_date + conference.start_hour.hours) }
end
it 'saves the event schedule to the database' do
@ -40,12 +40,12 @@ describe Admin::EventSchedulesController do
context 'with invalid attributes' do
let(:create_action) do
post :create, conference_id: conference.short_title, event_schedule:
post :create, params: { conference_id: conference.short_title, event_schedule:
attributes_for(:event_schedule,
schedule_id: schedule.id,
event_id: nil,
room_id: nil,
start_time: nil)
start_time: nil) }
end
it 'does not save the event schedule to the database' do
@ -62,12 +62,12 @@ describe Admin::EventSchedulesController do
describe 'POST #update' do
context 'with valid attributes' do
before :each do
patch :update, id: event_schedule.id, conference_id: conference.short_title, event_schedule:
patch :update, params: { id: event_schedule.id, conference_id: conference.short_title, event_schedule:
attributes_for(:event_schedule,
schedule_id: schedule.id,
event_id: create(:event, program: conference.program).id,
room_id: room.id,
start_time: conference.start_date + conference.start_hour.hours)
start_time: conference.start_date + conference.start_hour.hours) }
event_schedule.reload
end
@ -86,12 +86,12 @@ describe Admin::EventSchedulesController do
context 'with invalid attributes' do
let(:update_action) do
patch :update, id: event_schedule.id, conference_id: conference.short_title, event_schedule:
patch :update, params: { id: event_schedule.id, conference_id: conference.short_title, event_schedule:
attributes_for(:event_schedule,
schedule_id: schedule.id,
event_id: nil,
room_id: nil,
start_time: nil)
start_time: nil) }
end
it 'does not save the event schedule to the database' do
expect{ update_action }.to_not change { event_schedule }
@ -106,7 +106,7 @@ describe Admin::EventSchedulesController do
describe 'DELETE #destroy' do
let(:destroy_action) do
delete :destroy, id: event_schedule.id, conference_id: conference.short_title
delete :destroy, params: { id: event_schedule.id, conference_id: conference.short_title }
end
it 'deletes the event schedule' do