mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
Merge pull request #12961 from mkllnk/total-on-hand
Remove unused stock aggregation
This commit is contained in:
@@ -211,10 +211,6 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
def total_on_hand
|
||||
stock_items.sum(&:count_on_hand)
|
||||
end
|
||||
|
||||
def properties_including_inherited
|
||||
# Product properties override producer properties
|
||||
ps = product_properties.all
|
||||
|
||||
@@ -84,14 +84,6 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
describe '#total_on_hand' do
|
||||
it 'returns sum of stock items count_on_hand' do
|
||||
product = build(:product)
|
||||
allow(product).to receive_messages stock_items: [double(Spree::StockItem, count_on_hand: 5)]
|
||||
expect(product.total_on_hand).to eql(5)
|
||||
end
|
||||
end
|
||||
|
||||
context "has stock movements" do
|
||||
let(:product) { create(:product) }
|
||||
let(:variant) { product.variants.first }
|
||||
|
||||
Reference in New Issue
Block a user