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.

Merge pull request #13338 from spree/fix/flaky-double-dependency-spec

Damian Legawiec5ce003a563a3
diff --git a/core/spec/jobs/spree/variants/remove_line_item_job_spec.rb b/core/spec/jobs/spree/variants/remove_line_item_job_spec.rb
index c321d89b9a..95218a1ca6 100644
--- a/core/spec/jobs/spree/variants/remove_line_item_job_spec.rb
+++ b/core/spec/jobs/spree/variants/remove_line_item_job_spec.rb
@@ -4,13 +4,11 @@ module Spree
describe Variants::RemoveLineItemJob, :job do
let!(:order) { create(:order_with_line_items) }
let!(:line_item) { order.line_items.take }
- let(:remove_line_item_service_double) { double('RemoveLineItemService') }
- it 'calls the cart_remove_item_service service' do
- expect(Spree::Dependencies.cart_remove_line_item_service).to receive(:constantize).and_return(remove_line_item_service_double)
- expect(remove_line_item_service_double).to receive(:call).with(order: order, line_item: line_item)
-
- described_class.perform_now(line_item: line_item)
+ it 'removes the line item from the order' do
+ expect {
+ described_class.perform_now(line_item: line_item)
+ }.to change { order.reload.line_items.count }.by(-1)
end
end
end