Do not refresh products cache when price destroyed - variant destruction is main (only?) trigger, it causes refresh

This commit is contained in:
Rohan Mitchell
2016-02-04 12:15:59 +11:00
parent f78826c9c7
commit 62c6530ca9
2 changed files with 2 additions and 5 deletions

View File

@@ -1,7 +1,6 @@
module Spree
Price.class_eval do
after_save :refresh_products_cache
after_destroy :refresh_products_cache
private

View File

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