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
Keep the tax-copy specs on a cart that can actually pay
Łukasz Adamczyke8709690b614
diff --git a/spree/core/spec/workflows/spree/carts/complete_spec.rb b/spree/core/spec/workflows/spree/carts/complete_spec.rbindex 85781e75a5..698b80e45f 100644--- a/spree/core/spec/workflows/spree/carts/complete_spec.rb+++ b/spree/core/spec/workflows/spree/carts/complete_spec.rb@@ -127,6 +127,11 @@ module Spreeline_item.reload.update!(tax_category: tax_category)endready_cart.recalculate_totals!++ # The factory sized the payment before this tax existed, so the cart is+ # now a pound short and completion would stop at payment processing —+ # which reads here as "the order has no tax rows".+ ready_cart.payments.first.update!(amount: ready_cart.reload.total)end# Queried directly rather than through order.tax_lines: the association@@ -138,16 +143,22 @@ module Spreeit 'gives the order exactly one tax row per taxed line item' doexpect(ready_cart.tax_lines.reload.where.not(line_item_id: nil).count).to eq(1)- order = described_class.call(cart: ready_cart).value- rows = order_rows(order).where.not(line_item_id: nil)+ result = described_class.call(cart: ready_cart)+ # Asserted explicitly: a failed completion returns the cart, and every+ # row assertion below would then read zero for the wrong reason.+ expect(result).to be_success++ rows = order_rows(result.value).where.not(line_item_id: nil)expect(rows.count).to eq(1)expect(rows.pluck(:line_item_id).uniq.length).to eq(1)endit 'keeps the summed rows equal to the order additional tax total' do- order = described_class.call(cart: ready_cart).value+ result = described_class.call(cart: ready_cart)+ expect(result).to be_success+ order = result.valueexpect(order_rows(order).sum(:amount)).to eq(order.additional_tax_total)endend