aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache/behaviors
diff options
context:
space:
mode:
authorEugene Kenny <elkenny@gmail.com>2017-05-14 22:06:34 +0100
committerJeremy Daer <jeremydaer@gmail.com>2017-06-10 14:48:20 -0700
commit52f90044a159559d94b4f597e9d79b44024ed09a (patch)
treed33eb020cbe50c8e8aa8540751c17a76c1d68b52 /activesupport/test/cache/behaviors
parent816a3763d9bb070bf339de32c6a3ce31a45369f8 (diff)
downloadrails-52f90044a159559d94b4f597e9d79b44024ed09a.tar.gz
rails-52f90044a159559d94b4f597e9d79b44024ed09a.tar.bz2
rails-52f90044a159559d94b4f597e9d79b44024ed09a.zip
Cache: test coverage for cleanup behavior with local cache strategy
No need to pass `#cleanup` options through to `LocalCache#clear`. Fixes #29081. References #25628.
Diffstat (limited to 'activesupport/test/cache/behaviors')
-rw-r--r--activesupport/test/cache/behaviors/local_cache_behavior.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/cache/behaviors/local_cache_behavior.rb b/activesupport/test/cache/behaviors/local_cache_behavior.rb
index 3fb358bd0c..8530296374 100644
--- a/activesupport/test/cache/behaviors/local_cache_behavior.rb
+++ b/activesupport/test/cache/behaviors/local_cache_behavior.rb
@@ -17,6 +17,21 @@ module LocalCacheBehavior
assert_nil @cache.read("foo")
end
+ def test_cleanup_clears_local_cache_but_not_remote_cache
+ skip unless @cache.class.instance_methods(false).include?(:cleanup)
+
+ @cache.with_local_cache do
+ @cache.write("foo", "bar")
+ assert_equal "bar", @cache.read("foo")
+
+ @cache.send(:bypass_local_cache) { @cache.write("foo", "baz") }
+ assert_equal "bar", @cache.read("foo")
+
+ @cache.cleanup
+ assert_equal "baz", @cache.read("foo")
+ end
+ end
+
def test_local_cache_of_write
@cache.with_local_cache do
@cache.write("foo", "bar")