From 3dc3ebe5845dd8e6c368dd1721c975cef6179b05 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 7 Mar 2023 08:38:30 +1100 Subject: [PATCH] Correctly include order id in return auth spec The route to update a return authorization must include the order number as id: /admin/orders/:order_id/return_authorizations/:id(.:format) The spec only worked because the controller's ivars were not reset between requests and the order was already set. But Rails 7 will reset the ivars and it failed finding the order without a given id. --- .../spree/admin/return_authorizations_controller_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/controllers/spree/admin/return_authorizations_controller_spec.rb b/spec/controllers/spree/admin/return_authorizations_controller_spec.rb index 7c19cfc7d3..cad5697347 100644 --- a/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +++ b/spec/controllers/spree/admin/return_authorizations_controller_spec.rb @@ -27,7 +27,8 @@ module Spree reset_controller_environment # Update return authorization - spree_put :update, id: return_authorization.id, + spree_put :update, order_id: order.number, + id: return_authorization.id, return_authorization: { amount: "10.2", reason: "half broken" } expect(response).to redirect_to spree.admin_order_return_authorizations_url(order.number)