mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Do not refresh products cache when price destroyed - variant destruction is main (only?) trigger, it causes refresh
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
module Spree
|
||||
Price.class_eval do
|
||||
after_save :refresh_products_cache
|
||||
after_destroy :refresh_products_cache
|
||||
|
||||
|
||||
private
|
||||
|
||||
@@ -12,10 +12,8 @@ module Spree
|
||||
price.save
|
||||
end
|
||||
|
||||
it "refreshes the products cache on destroy" do
|
||||
expect(OpenFoodNetwork::ProductsCache).to receive(:variant_changed).with(variant)
|
||||
price.destroy
|
||||
end
|
||||
# Do not refresh on price destruction - this (only?) happens when variant is destroyed,
|
||||
# and in that case the variant will take responsibility for refreshing the cache
|
||||
|
||||
it "does not refresh the cache when variant is not set" do
|
||||
# Creates a price without the back link to variant
|
||||
|
||||
Reference in New Issue
Block a user