aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-04-15 00:03:46 -0400
committerGitHub <noreply@github.com>2018-04-15 00:03:46 -0400
commitd472229f1fb76f73b6bc678191057a554ce52f51 (patch)
tree68aaec5a206fb7371d3cf2c41cd53aa6df1bd0b8 /activesupport/test/cache
parentf9440ee361b5cfd1d2cf0c69201cf5d1960532fb (diff)
parent92db9e46f8dced015a236f073187e4ea50c7e13c (diff)
downloadrails-d472229f1fb76f73b6bc678191057a554ce52f51.tar.gz
rails-d472229f1fb76f73b6bc678191057a554ce52f51.tar.bz2
rails-d472229f1fb76f73b6bc678191057a554ce52f51.zip
Merge pull request #32573 from chloerei/fix-redis-store-clear-namespace
Fix redis store clear keys outside the namespace
Diffstat (limited to 'activesupport/test/cache')
-rw-r--r--activesupport/test/cache/stores/redis_cache_store_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/test/cache/stores/redis_cache_store_test.rb b/activesupport/test/cache/stores/redis_cache_store_test.rb
index dda96b68fb..3cae2bb11f 100644
--- a/activesupport/test/cache/stores/redis_cache_store_test.rb
+++ b/activesupport/test/cache/stores/redis_cache_store_test.rb
@@ -221,4 +221,22 @@ module ActiveSupport::Cache::RedisCacheStoreTests
end
end
end
+
+ class ClearTest < StoreTest
+ test "clear all cache key" do
+ @cache.write("foo", "bar")
+ @cache.write("fu", "baz")
+ @cache.clear
+ assert !@cache.exist?("foo")
+ assert !@cache.exist?("fu")
+ end
+
+ test "only clear namespace cache key" do
+ @cache.write("foo", "bar")
+ @cache.redis.set("fu", "baz")
+ @cache.clear
+ assert !@cache.exist?("foo")
+ assert @cache.redis.exists("fu")
+ end
+ end
end