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
Add Variant.out_of_stock? examples.
Sebastian Palma698c257c7c3a
diff --git a/core/spec/models/spree/variant_spec.rb b/core/spec/models/spree/variant_spec.rbindex dbb8077a17..2333a2d803 100644--- a/core/spec/models/spree/variant_spec.rb+++ b/core/spec/models/spree/variant_spec.rb@@ -98,12 +98,14 @@ describe Spree::Variant, type: :model docontext 'when product is created without variants but with stock' doit { expect(product.master).to be_in_stock }+ it { expect(product.master).not_to be_out_of_stock }endcontext 'when a variant is created' dolet!(:new_variant) { create(:variant, product: product) }it { expect(product.master).not_to be_in_stock }+ it { expect(product.master).to be_out_of_stock }endendend@@ -534,6 +536,7 @@ describe Spree::Variant, type: :model doit 'returns true if stock_items in stock' doexpect(variant.in_stock?).to be true+ expect(variant.out_of_stock?).to be falseendend@@ -545,6 +548,7 @@ describe Spree::Variant, type: :model doit 'return false if stock_items out of stock' doexpect(variant.in_stock?).to be false+ expect(variant.out_of_stock?).to be trueendendend@@ -569,6 +573,7 @@ describe Spree::Variant, type: :model doit 'in_stock? returns false' doexpect(variant.in_stock?).to be false+ expect(variant.out_of_stock?).to be trueendit 'can_supply? return true' do