From 50a595afb96b8b99e713f5c00294f3fa0e5ba970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 23 Nov 2016 09:55:09 +0100 Subject: [PATCH] Fix controller testing params deprecation --- .../controllers/cost_types_controller_spec.rb | 4 ++-- spec/controllers/costlog_controller_spec.rb | 22 +++++++++---------- .../hourly_rates_controller_spec.rb | 2 +- .../work_packages_bulk_controller_spec.rb | 5 ++++- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/spec/controllers/cost_types_controller_spec.rb b/spec/controllers/cost_types_controller_spec.rb index 6b9938e2a8..7ddff02eea 100644 --- a/spec/controllers/cost_types_controller_spec.rb +++ b/spec/controllers/cost_types_controller_spec.rb @@ -26,7 +26,7 @@ describe CostTypesController, type: :controller do describe 'DELETE destroy' do it 'allows an admin to delete' do as_logged_in_user admin do - delete :destroy, id: cost_type.id + delete :destroy, params: { id: cost_type.id } end expect(assigns(:cost_type).deleted_at).to be_a Time @@ -42,7 +42,7 @@ describe CostTypesController, type: :controller do it 'allows an admin to restore' do as_logged_in_user admin do - patch :restore, id: cost_type.id + patch :restore, params: { id: cost_type.id } end expect(assigns(:cost_type).deleted_at).to be_nil diff --git a/spec/controllers/costlog_controller_spec.rb b/spec/controllers/costlog_controller_spec.rb index f821092238..f6f7bbdde5 100644 --- a/spec/controllers/costlog_controller_spec.rb +++ b/spec/controllers/costlog_controller_spec.rb @@ -88,7 +88,7 @@ describe CostlogController, type: :controller do shared_examples_for 'successful new' do before do - get :new, params + get :new, params: { params } end it { expect(response).to be_success } @@ -98,7 +98,7 @@ describe CostlogController, type: :controller do shared_examples_for 'forbidden new' do before do - get :new, params + get :new, params: { params } end it { expect(response.response_code).to eq(403) } @@ -152,7 +152,7 @@ describe CostlogController, type: :controller do shared_examples_for 'successful edit' do before do - get :edit, params + get :edit, params: { params } end it { expect(response).to be_success } @@ -163,7 +163,7 @@ describe CostlogController, type: :controller do shared_examples_for 'forbidden edit' do before do - get :edit, params + get :edit, params: { params } end it { expect(response.response_code).to eq(403) } @@ -239,7 +239,7 @@ describe CostlogController, type: :controller do params['id'] = (cost_entry.id + 1).to_s - get :edit, params + get :edit, params: { params } end it { expect(response.response_code).to eq(404) } @@ -276,7 +276,7 @@ describe CostlogController, type: :controller do shared_examples_for 'successful create' do before do - post :create, params + post :create, params: { params } end # is this really usefull, shouldn't it redirect to the creating work_package by default? @@ -288,7 +288,7 @@ describe CostlogController, type: :controller do shared_examples_for 'invalid create' do before do - post :create, params + post :create, params: { params } end it { expect(response).to be_success } @@ -298,7 +298,7 @@ describe CostlogController, type: :controller do shared_examples_for 'forbidden create' do before do - post :create, params + post :create, params: { params } end it { expect(response.response_code).to eq(403) } @@ -502,7 +502,7 @@ describe CostlogController, type: :controller do shared_examples_for 'successful update' do before do - put :update, params + put :update, params: { params } end it { expect(response).to redirect_to(controller: 'costlog', action: 'index', project_id: project) } @@ -513,7 +513,7 @@ describe CostlogController, type: :controller do end shared_examples_for 'invalid update' do - before { put :update, params } + before { put :update, params: { params } } it_should_behave_like 'assigns' it { expect(response).to be_success } @@ -522,7 +522,7 @@ describe CostlogController, type: :controller do shared_examples_for 'forbidden update' do before do - put :update, params + put :update, params: { params } end it { expect(response.response_code).to eq(403) } diff --git a/spec/controllers/hourly_rates_controller_spec.rb b/spec/controllers/hourly_rates_controller_spec.rb index 788b00db52..f2d534a3ca 100644 --- a/spec/controllers/hourly_rates_controller_spec.rb +++ b/spec/controllers/hourly_rates_controller_spec.rb @@ -34,7 +34,7 @@ describe HourlyRatesController do } before do as_logged_in_user admin do - post :update, params + post :update, params: { params } end end diff --git a/spec/controllers/work_packages_bulk_controller_spec.rb b/spec/controllers/work_packages_bulk_controller_spec.rb index 6ed6731c9e..d4e62af375 100644 --- a/spec/controllers/work_packages_bulk_controller_spec.rb +++ b/spec/controllers/work_packages_bulk_controller_spec.rb @@ -32,7 +32,10 @@ describe WorkPackages::BulkController, type: :controller do describe '#update' do context 'when a cost report is assigned' do - before do put :update, ids: [work_package.id], work_package: { cost_object_id: cost_object.id } end + before do + put :update, params: { ids: [work_package.id], + work_package: { cost_object_id: cost_object.id } } + end subject { work_package.reload.cost_object.try :id }