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:
Matt-Yorkley
2020-10-17 00:16:11 +01:00
parent 93fe8dbc5f
commit 01a726d9bd

View File

@@ -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