mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-15 23:57:48 +00:00
Remove unneeded method StockLocation#propagate_variant
This commit is contained in:
@@ -18,10 +18,6 @@ module Spree
|
||||
after_create :create_stock_items
|
||||
|
||||
# Wrapper for creating a new stock item respecting the backorderable config
|
||||
def propagate_variant(variant)
|
||||
stock_items.create!(variant:)
|
||||
end
|
||||
|
||||
def stock_item(variant)
|
||||
stock_items.where(variant_id: variant).order(:id).first
|
||||
end
|
||||
@@ -57,7 +53,7 @@ module Spree
|
||||
private
|
||||
|
||||
def create_stock_items
|
||||
Variant.find_each { |variant| propagate_variant(variant) }
|
||||
Variant.find_each { |variant| stock_items.create!(variant:) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -243,7 +243,7 @@ module Spree
|
||||
return unless stock_items.empty?
|
||||
|
||||
StockLocation.find_each do |stock_location|
|
||||
stock_location.propagate_variant(self)
|
||||
stock_items.create!(stock_location:)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ module Spree
|
||||
subject { StockLocation.new(name: "testing") }
|
||||
|
||||
specify do
|
||||
expect(subject).to receive(:propagate_variant).at_least(:once)
|
||||
expect(subject.stock_items).to receive(:create!).at_least(:once)
|
||||
subject.save!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user