mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix stubbing of stock totals
Recent changes to the way count_on_hand is summed in Spree::Stock::Quantifier mean the old method here will not work. Error:
```
2) Spree::Variant#in_stock? when stock_items are not backorderable when stock_items out of stock return false if stock_items out of stock
Failure/Error: expect(variant.in_stock?).to be_falsy
expected: falsey value
got: true
# ./spec/models/spree/variant_spec.rb:241:in `block (5 levels) in <module:Spree>'
```
This commit is contained in:
@@ -234,7 +234,7 @@ module Spree
|
||||
context 'when stock_items out of stock' do
|
||||
before do
|
||||
allow_any_instance_of(Spree::StockItem).to receive_messages(backorderable: false)
|
||||
allow_any_instance_of(Spree::StockItem).to receive_messages(count_on_hand: 0)
|
||||
allow_any_instance_of(Spree::Stock::Quantifier).to receive_messages(total_on_hand: 0)
|
||||
end
|
||||
|
||||
it 'return false if stock_items out of stock' do
|
||||
|
||||
Reference in New Issue
Block a user