diff --git a/app/models/spree/price_decorator.rb b/app/models/spree/price_decorator.rb index 0dd3a5a0c6..f50a86066b 100644 --- a/app/models/spree/price_decorator.rb +++ b/app/models/spree/price_decorator.rb @@ -1,7 +1,6 @@ module Spree Price.class_eval do after_save :refresh_products_cache - after_destroy :refresh_products_cache private diff --git a/spec/models/spree/price_spec.rb b/spec/models/spree/price_spec.rb index 378925f052..5d48afd95b 100644 --- a/spec/models/spree/price_spec.rb +++ b/spec/models/spree/price_spec.rb @@ -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