A platform for community discussion. Free, open, simple.
DEV: Properly flush `DistributedMemoizer` in spec.
Guo Xiang Tan72d14a11ab7c
diff --git a/lib/distributed_memoizer.rb b/lib/distributed_memoizer.rbindex e80b687923a..3be926658a5 100644--- a/lib/distributed_memoizer.rb+++ b/lib/distributed_memoizer.rb@@ -46,6 +46,11 @@ class DistributedMemoizer"memoize_" << keyend+ # Used for testing+ def self.flush!+ $redis.scan_each(match: "memoize_*").each { |key| $redis.del(key) }+ end+protecteddef self.get_lock(redis, redis_lock_key)diff --git a/spec/requests/static_controller_spec.rb b/spec/requests/static_controller_spec.rbindex b3613bea94f..7db1cdbb21b 100644--- a/spec/requests/static_controller_spec.rb+++ b/spec/requests/static_controller_spec.rb@@ -9,7 +9,7 @@ describe StaticController dobefore { FinalDestination.stubs(:lookup_ip).returns("1.2.3.4") }after do- $redis.flushall+ DistributedMemoizer.flush!endit 'returns the default favicon for a missing download' do