Remove Rails 5.0 controller spec workaround

We added a method to work around a bug. But that's not needed any more.
This commit is contained in:
Maikel Linke
2023-03-07 08:45:10 +11:00
parent 3dc3ebe584
commit 797b98d686
3 changed files with 0 additions and 13 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -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