mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 21:11:10 +08:00
DEV: Properly flush DistributedMemoizer
in spec.
- $redis.flushall may hide state leak from other tests.
This commit is contained in:
@ -46,6 +46,11 @@ class DistributedMemoizer
|
|||||||
"memoize_" << key
|
"memoize_" << key
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Used for testing
|
||||||
|
def self.flush!
|
||||||
|
$redis.scan_each(match: "memoize_*").each { |key| $redis.del(key) }
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def self.get_lock(redis, redis_lock_key)
|
def self.get_lock(redis, redis_lock_key)
|
||||||
|
@ -9,7 +9,7 @@ describe StaticController do
|
|||||||
before { FinalDestination.stubs(:lookup_ip).returns("1.2.3.4") }
|
before { FinalDestination.stubs(:lookup_ip).returns("1.2.3.4") }
|
||||||
|
|
||||||
after do
|
after do
|
||||||
$redis.flushall
|
DistributedMemoizer.flush!
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns the default favicon for a missing download' do
|
it 'returns the default favicon for a missing download' do
|
||||||
|
Reference in New Issue
Block a user