Fix controller testing params deprecation

pull/6827/head
Oliver Günther 8 years ago
parent 5f831769a2
commit 50a595afb9
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 4
      spec/controllers/cost_types_controller_spec.rb
  2. 22
      spec/controllers/costlog_controller_spec.rb
  3. 2
      spec/controllers/hourly_rates_controller_spec.rb
  4. 5
      spec/controllers/work_packages_bulk_controller_spec.rb

@ -26,7 +26,7 @@ describe CostTypesController, type: :controller do
describe 'DELETE destroy' do describe 'DELETE destroy' do
it 'allows an admin to delete' do it 'allows an admin to delete' do
as_logged_in_user admin do as_logged_in_user admin do
delete :destroy, id: cost_type.id delete :destroy, params: { id: cost_type.id }
end end
expect(assigns(:cost_type).deleted_at).to be_a Time 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 it 'allows an admin to restore' do
as_logged_in_user admin do as_logged_in_user admin do
patch :restore, id: cost_type.id patch :restore, params: { id: cost_type.id }
end end
expect(assigns(:cost_type).deleted_at).to be_nil expect(assigns(:cost_type).deleted_at).to be_nil

@ -88,7 +88,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful new' do shared_examples_for 'successful new' do
before do before do
get :new, params get :new, params: { params }
end end
it { expect(response).to be_success } it { expect(response).to be_success }
@ -98,7 +98,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden new' do shared_examples_for 'forbidden new' do
before do before do
get :new, params get :new, params: { params }
end end
it { expect(response.response_code).to eq(403) } it { expect(response.response_code).to eq(403) }
@ -152,7 +152,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful edit' do shared_examples_for 'successful edit' do
before do before do
get :edit, params get :edit, params: { params }
end end
it { expect(response).to be_success } it { expect(response).to be_success }
@ -163,7 +163,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden edit' do shared_examples_for 'forbidden edit' do
before do before do
get :edit, params get :edit, params: { params }
end end
it { expect(response.response_code).to eq(403) } 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 params['id'] = (cost_entry.id + 1).to_s
get :edit, params get :edit, params: { params }
end end
it { expect(response.response_code).to eq(404) } it { expect(response.response_code).to eq(404) }
@ -276,7 +276,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful create' do shared_examples_for 'successful create' do
before do before do
post :create, params post :create, params: { params }
end end
# is this really usefull, shouldn't it redirect to the creating work_package by default? # 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 shared_examples_for 'invalid create' do
before do before do
post :create, params post :create, params: { params }
end end
it { expect(response).to be_success } it { expect(response).to be_success }
@ -298,7 +298,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden create' do shared_examples_for 'forbidden create' do
before do before do
post :create, params post :create, params: { params }
end end
it { expect(response.response_code).to eq(403) } it { expect(response.response_code).to eq(403) }
@ -502,7 +502,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful update' do shared_examples_for 'successful update' do
before do before do
put :update, params put :update, params: { params }
end end
it { expect(response).to redirect_to(controller: 'costlog', action: 'index', project_id: project) } it { expect(response).to redirect_to(controller: 'costlog', action: 'index', project_id: project) }
@ -513,7 +513,7 @@ describe CostlogController, type: :controller do
end end
shared_examples_for 'invalid update' do shared_examples_for 'invalid update' do
before { put :update, params } before { put :update, params: { params } }
it_should_behave_like 'assigns' it_should_behave_like 'assigns'
it { expect(response).to be_success } it { expect(response).to be_success }
@ -522,7 +522,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden update' do shared_examples_for 'forbidden update' do
before do before do
put :update, params put :update, params: { params }
end end
it { expect(response.response_code).to eq(403) } it { expect(response.response_code).to eq(403) }

@ -34,7 +34,7 @@ describe HourlyRatesController do
} }
before do before do
as_logged_in_user admin do as_logged_in_user admin do
post :update, params post :update, params: { params }
end end
end end

@ -32,7 +32,10 @@ describe WorkPackages::BulkController, type: :controller do
describe '#update' do describe '#update' do
context 'when a cost report is assigned' 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 } subject { work_package.reload.cost_object.try :id }

Loading…
Cancel
Save