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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix MySQL broken HasWebhooks examples.
Sebastian Palmaedb66a62acd9
diff --git a/api/app/models/concerns/spree/webhooks/has_webhooks.rb b/api/app/models/concerns/spree/webhooks/has_webhooks.rbindex e2c476ec8a..6ff9a35614 100644--- a/api/app/models/concerns/spree/webhooks/has_webhooks.rb+++ b/api/app/models/concerns/spree/webhooks/has_webhooks.rb@@ -30,7 +30,7 @@ module Spreedef payloadresource_serializer.new(self).serializable_hash- rescue NoMethodError+ rescue NameError, NoMethodError{}enddiff --git a/api/app/services/spree/webhooks/endpoints/make_request.rb b/api/app/services/spree/webhooks/endpoints/make_request.rbindex dcab4e1e7e..b771e4b584 100644--- a/api/app/services/spree/webhooks/endpoints/make_request.rb+++ b/api/app/services/spree/webhooks/endpoints/make_request.rb@@ -5,7 +5,6 @@ module Spreeprepend Spree::ServiceModule::Basedef call(url:)- p urlrun :make_requestenddiff --git a/api/app/services/spree/webhooks/endpoints/queue_requests.rb b/api/app/services/spree/webhooks/endpoints/queue_requests.rbindex e95715e26d..aa3f24ec43 100644--- a/api/app/services/spree/webhooks/endpoints/queue_requests.rb+++ b/api/app/services/spree/webhooks/endpoints/queue_requests.rb@@ -3,7 +3,6 @@ module Spreeprepend Spree::ServiceModule::Basedef call(event:, payload:)- p payloadurls_subscribed_to(event).each do |url|Spree::Webhooks::Endpoints::MakeRequestJob.perform_later(url)enddiff --git a/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb b/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rbindex c498b9f28d..f54b7e82c5 100644--- a/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb+++ b/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb@@ -1,7 +1,7 @@require 'spec_helper'-module Spree- class Webhooks::Product < ActiveRecord::Base+module Test+ class Product < ActiveRecord::Baseself.table_name = 'test_products'include Spree::Webhooks::HasWebhooks@@ -9,20 +9,18 @@ module Spreeenddescribe Spree::Webhooks::HasWebhooks do- let(:connection) { ActiveRecord::Base.connection }-- before do- connection.create_table :test_products, force: true do |t|+ before(:all) do+ ActiveRecord::Base.connection.create_table :test_products, force: true do |t|t.string :nameendend- after do- connection.drop_table :test_products, if_exists: true+ after(:all) do+ ActiveRecord::Base.connection.drop_table :test_products, if_exists: trueendcontext 'with a Spree::Webhooks class including the module' do- let!(:product) { Spree::Webhooks::Product.create(name: 'test') }+ let!(:product) { Test::Product.create(name: 'test') }context 'after commit on create' doit 'does not execute the webhook callback' dodiff --git a/api/spec/serializers/spree/api/v2/platform/menu_item_serializer_spec.rb b/api/spec/serializers/spree/api/v2/platform/menu_item_serializer_spec.rbindex 3a3c58e426..b463ba11e4 100644--- a/api/spec/serializers/spree/api/v2/platform/menu_item_serializer_spec.rb+++ b/api/spec/serializers/spree/api/v2/platform/menu_item_serializer_spec.rb@@ -5,14 +5,17 @@ describe Spree::Api::V2::Platform::MenuItemSerializer dolet(:menu) { create(:menu) }let(:menu_item) { create(:menu_item, menu: menu, linked_resource: create(:taxon)) }- let!(:children) do+ let(:children) do[create(:menu_item, parent_id: menu_item.id, menu: menu),create(:menu_item, parent_id: menu_item.id, menu: menu)]end- before { menu_item.reload }+ before do+ allow_any_instance_of(Spree::Base).to receive(:queue_webhooks_requests!)+ children+ endit { expect(subject.serializable_hash).to be_kind_of(Hash) }