From bb8dfb124ec26174250309cde649d903bf130ff6 Mon Sep 17 00:00:00 2001
From: Sam Saffron <sam.saffron@gmail.com>
Date: Mon, 3 Jun 2019 10:21:38 +1000
Subject: [PATCH] DEV: change testing cache clearing so it is more deliberate

This test is flaky, this changes it so we always start tests with a clean
cache (concurrency and redis delays pending)
---
 spec/integration/watched_words_spec.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/spec/integration/watched_words_spec.rb b/spec/integration/watched_words_spec.rb
index 2e3853be08e..2569247e12a 100644
--- a/spec/integration/watched_words_spec.rb
+++ b/spec/integration/watched_words_spec.rb
@@ -14,8 +14,12 @@ describe WatchedWord do
   let(:flag_word) { Fabricate(:watched_word, action: WatchedWord.actions[:flag]) }
   let(:block_word) { Fabricate(:watched_word, action: WatchedWord.actions[:block]) }
 
+  before_all do
+    WordWatcher.clear_cache!
+  end
+
   after do
-    $redis.flushall
+    WordWatcher.clear_cache!
   end
 
   context "block" do