From 797b98d68684f4b4be7fa1e61e63811da61d2ae4 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 7 Mar 2023 08:45:10 +1100 Subject: [PATCH] Remove Rails 5.0 controller spec workaround We added a method to work around a bug. But that's not needed any more. --- spec/controllers/admin/schedules_controller_spec.rb | 2 -- .../spree/admin/return_authorizations_controller_spec.rb | 3 --- spec/support/controller_helper.rb | 8 -------- 3 files changed, 13 deletions(-) diff --git a/spec/controllers/admin/schedules_controller_spec.rb b/spec/controllers/admin/schedules_controller_spec.rb index 75fb5eea72..97a0fbcce8 100644 --- a/spec/controllers/admin/schedules_controller_spec.rb +++ b/spec/controllers/admin/schedules_controller_spec.rb @@ -122,10 +122,8 @@ describe Admin::SchedulesController, type: :controller do spree_put :update, format: :json, id: coordinated_schedule.id, order_cycle_ids: [coordinated_order_cycle.id, coordinated_order_cycle2.id] - reset_controller_environment spree_put :update, format: :json, id: coordinated_schedule.id, order_cycle_ids: [coordinated_order_cycle.id] - reset_controller_environment spree_put :update, format: :json, id: coordinated_schedule.id, order_cycle_ids: [coordinated_order_cycle.id] end diff --git a/spec/controllers/spree/admin/return_authorizations_controller_spec.rb b/spec/controllers/spree/admin/return_authorizations_controller_spec.rb index cad5697347..aaf7bc81d6 100644 --- a/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +++ b/spec/controllers/spree/admin/return_authorizations_controller_spec.rb @@ -23,9 +23,6 @@ module Spree expect(return_authorization.amount.to_s).to eq "20.2" expect(return_authorization.reason.to_s).to eq "broken" - # Reset the test controller between requests - reset_controller_environment - # Update return authorization spree_put :update, order_id: order.number, id: return_authorization.id, diff --git a/spec/support/controller_helper.rb b/spec/support/controller_helper.rb index df64e2a438..622afe37f6 100644 --- a/spec/support/controller_helper.rb +++ b/spec/support/controller_helper.rb @@ -24,13 +24,5 @@ module OpenFoodNetwork allow(controller).to receive_messages(spree_current_user: @enterprise_user) end - - def reset_controller_environment - # Rails 5.0 introduced a bug in controller tests (fixed in 5.2) where the controller's - # environment is essentially cached if multiple requests are made in the same `it` block, - # meaning subsequent requests will not be handled well. This resets the environment. - # This edge case is quite rare though; normally we only do one request per test. - @request.env.delete("RAW_POST_DATA") - end end end