aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorJason Lee <huacnlee@gmail.com>2018-03-21 14:16:00 +0800
committerJason Lee <huacnlee@gmail.com>2018-03-21 14:16:00 +0800
commit4e13a364a67e02ed0b3b8f69bac84d69632f58f6 (patch)
treeda4aec84d75b3859df9400efb963aa9afaea218e /activesupport/test
parentfab6ded8f299d51593f4d68f4f9b7b03b44aa2c3 (diff)
downloadrails-4e13a364a67e02ed0b3b8f69bac84d69632f58f6.tar.gz
rails-4e13a364a67e02ed0b3b8f69bac84d69632f58f6.tar.bz2
rails-4e13a364a67e02ed0b3b8f69bac84d69632f58f6.zip
Fix Cache `read_multi` with local_cache return values.
It should returns raw value, not instance of `ActiveSupport::Cache::Entry`.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/cache/behaviors/local_cache_behavior.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/cache/behaviors/local_cache_behavior.rb b/activesupport/test/cache/behaviors/local_cache_behavior.rb
index 363f2d1084..baa38ba6ac 100644
--- a/activesupport/test/cache/behaviors/local_cache_behavior.rb
+++ b/activesupport/test/cache/behaviors/local_cache_behavior.rb
@@ -129,6 +129,18 @@ module LocalCacheBehavior
end
end
+ def test_local_cache_of_read_multi
+ @cache.with_local_cache do
+ @cache.write("foo", "foo", raw: true)
+ @cache.write("bar", "bar", raw: true)
+ values = @cache.read_multi("foo", "bar")
+ assert_equal "foo", @cache.read("foo")
+ assert_equal "bar", @cache.read("bar")
+ assert_equal "foo", values["foo"]
+ assert_equal "bar", values["bar"]
+ end
+ end
+
def test_middleware
app = lambda { |env|
result = @cache.write("foo", "bar")