Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Let the suite see a callback pointing at an action that is gone (#14571)

Damian Legawiec354cd0af58b9
diff --git a/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb
index 36c86d5c6c..4a5fbe3350 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb
@@ -6,7 +6,7 @@ module Spree
class FulfillmentsController < BaseController
scoped_resource :fulfillments
- before_action :set_resource, only: [:show, :update, :fulfill, :purchase_label, :mark_delivered, :cancel, :resume, :split]
+ before_action :set_resource, only: [:show, :update, :fulfill, :purchase_label, :mark_delivered, :cancel, :split]
# POST /api/v3/admin/orders/:order_id/fulfillments
#
diff --git a/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
index e37ede236d..70c9a5bca8 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/orders_controller.rb
@@ -14,7 +14,7 @@ module Spree
rescue_from ActiveSupport::MessageVerifier::InvalidSignature, with: :render_invalid_po_document
skip_before_action :set_resource, only: [:index, :create]
- before_action :set_resource, only: [:show, :update, :destroy, :complete, :cancel, :approve, :resume, :resend_confirmation, :resend_digital_links, :po_document]
+ before_action :set_resource, only: [:show, :update, :destroy, :complete, :cancel, :approve, :resend_confirmation, :resend_digital_links, :po_document]
# POST /api/v3/admin/orders
def create
@@ -175,7 +175,7 @@ module Spree
# Map state transition actions to :update permission
def authorize_resource!(resource = @resource, action = action_name.to_sym)
mapped_action = case action
- when :complete, :cancel, :approve, :resume, :resend_confirmation, :resend_digital_links
+ when :complete, :cancel, :approve, :resend_confirmation, :resend_digital_links
:update
when :po_document
:show
diff --git a/spree/core/lib/generators/spree/dummy/templates/rails/test.rb b/spree/core/lib/generators/spree/dummy/templates/rails/test.rb
index c75a624ed7..cd79da0d88 100644
--- a/spree/core/lib/generators/spree/dummy/templates/rails/test.rb
+++ b/spree/core/lib/generators/spree/dummy/templates/rails/test.rb
@@ -23,6 +23,11 @@ Dummy::Application.configure do
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
+ # A `before_action ... only: [:gone_action]` naming an action that no longer
+ # exists makes Rails refuse every request to that controller. Enabled here so
+ # the suite sees it, as every real Spree app does.
+ config.action_controller.raise_on_missing_callback_actions = true
+
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.