diff --git a/lib/open_food_network/products_cache.rb b/lib/open_food_network/products_cache.rb index 556b488316..1d1dab8cd0 100644 --- a/lib/open_food_network/products_cache.rb +++ b/lib/open_food_network/products_cache.rb @@ -36,6 +36,7 @@ module OpenFoodNetwork def self.variant_override_destroyed(variant_override) + variant_override_changed variant_override end diff --git a/spec/lib/open_food_network/products_cache_spec.rb b/spec/lib/open_food_network/products_cache_spec.rb index ef3f3ed279..2004ececaa 100644 --- a/spec/lib/open_food_network/products_cache_spec.rb +++ b/spec/lib/open_food_network/products_cache_spec.rb @@ -108,6 +108,16 @@ module OpenFoodNetwork end + describe "when a variant override is destroyed" do + let(:vo) { double(:variant_override) } + + it "performs the same refresh as a variant override change" do + expect(ProductsCache).to receive(:variant_override_changed).with(vo) + ProductsCache.variant_override_destroyed vo + end + end + + describe "refreshing the cache" do let(:distributor) { double(:distributor, id: 123) } let(:order_cycle) { double(:order_cycle, id: 456) }