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.

destroy -> delete update event name.

Sebastian Palmaada20b803c9c
diff --git a/api/app/models/concerns/spree/webhooks/has_webhooks.rb b/api/app/models/concerns/spree/webhooks/has_webhooks.rb
index f6d57e566c..9b4ce25fad 100644
--- a/api/app/models/concerns/spree/webhooks/has_webhooks.rb
+++ b/api/app/models/concerns/spree/webhooks/has_webhooks.rb
@@ -5,7 +5,7 @@ module Spree
included do
after_create_commit(proc { queue_webhooks_requests!(event_name(:create)) })
- after_destroy_commit(proc { queue_webhooks_requests!(event_name(:destroy)) })
+ after_destroy_commit(proc { queue_webhooks_requests!(event_name(:delete)) })
after_update_commit(proc { queue_webhooks_requests!(event_name(:update)) })
def queue_webhooks_requests!(event)
diff --git a/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb b/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb
index bf9772be55..b8bb8e1676 100644
--- a/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb
+++ b/api/spec/models/concerns/spree/webhooks/has_webhooks_spec.rb
@@ -31,7 +31,7 @@ describe Spree::Webhooks::HasWebhooks do
context 'after_destroy_commit' do
before { product.destroy }
- it_behaves_like 'not queueing an event request', 'product.destroy'
+ it_behaves_like 'not queueing an event request', 'product.delete'
end
context 'after_update_commit' do
@@ -51,7 +51,7 @@ describe Spree::Webhooks::HasWebhooks do
context 'after_destroy_commit' do
before { product.save }
- it { expect { product.destroy }.to emit_webhook_event('product.destroy') }
+ it { expect { product.destroy }.to emit_webhook_event('product.delete') }
end
context 'after_update_commit' do
diff --git a/api/spec/models/spree/api/webhooks/order_decorator_spec.rb b/api/spec/models/spree/api/webhooks/order_decorator_spec.rb
index 359f9f59f6..d64ce87068 100644
--- a/api/spec/models/spree/api/webhooks/order_decorator_spec.rb
+++ b/api/spec/models/spree/api/webhooks/order_decorator_spec.rb
@@ -16,7 +16,7 @@ describe Spree::Api::Webhooks::OrderDecorator do
describe 'order.placed' do
describe 'checkout -> completed' do
- let(:order) { described_class.create(email: '[email protected]', store: store) }
+ let(:order) { create(:order, email: '[email protected]', store: store) }
it { expect { Timecop.freeze { order.finalize! } }.to emit_webhook_event('order.placed') }
end