From 01d741509f6744688f397d2f5e2d30cf45254548 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Thu, 7 May 2020 15:20:37 +0200 Subject: [PATCH] Fix test of rendered properties AMS Here the displayed properties that we're testing also rely on shops data (including the list of supplied properties), which is now cached for 15 seconds. We clear that cache entry so we can cleanly test only the caching of the properties AMS array. --- spec/features/consumer/caching/darkwarm_caching_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/features/consumer/caching/darkwarm_caching_spec.rb b/spec/features/consumer/caching/darkwarm_caching_spec.rb index 6dcbc18ac5..e1162e2961 100644 --- a/spec/features/consumer/caching/darkwarm_caching_spec.rb +++ b/spec/features/consumer/caching/darkwarm_caching_spec.rb @@ -50,6 +50,9 @@ feature "Darkswarm data caching", js: true, caching: true do property.presentation = "Changed Property" property.save + # Clear timed shops cache so we can test uncached supplied properties + clear_shops_cache + visit shops_path taxon_timestamp2 = CacheService.latest_timestamp_by_class(Spree::Taxon) @@ -73,4 +76,9 @@ feature "Darkswarm data caching", js: true, caching: true do def expect_cached(key) expect(Rails.cache.exist?(key)).to be true end + + def clear_shops_cache + cache_key = "views/#{CacheService::FragmentCaching.ams_shops[0]}" + Rails.cache.delete cache_key + end end