aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache/behaviors
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-07-15 21:57:20 +0100
committerGitHub <noreply@github.com>2019-07-15 21:57:20 +0100
commitf30f76af747858826d3618866676cd5a4979e64a (patch)
treeef01a081fd44ab0f9733bcb46a116808b0f5771a /activesupport/test/cache/behaviors
parentbcbe3dc6108704769d660fb6fd56b70d1ae77092 (diff)
parentf08bf726d3038f062dd7485614d1ea85d952f121 (diff)
downloadrails-f30f76af747858826d3618866676cd5a4979e64a.tar.gz
rails-f30f76af747858826d3618866676cd5a4979e64a.tar.bz2
rails-f30f76af747858826d3618866676cd5a4979e64a.zip
Merge pull request #36656 from Edouard-chin/ec-local-cache-reference
Return a copy of the cache entry when local_cache exists:
Diffstat (limited to 'activesupport/test/cache/behaviors')
-rw-r--r--activesupport/test/cache/behaviors/local_cache_behavior.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/test/cache/behaviors/local_cache_behavior.rb b/activesupport/test/cache/behaviors/local_cache_behavior.rb
index baa38ba6ac..6f5d53c190 100644
--- a/activesupport/test/cache/behaviors/local_cache_behavior.rb
+++ b/activesupport/test/cache/behaviors/local_cache_behavior.rb
@@ -46,6 +46,15 @@ module LocalCacheBehavior
end
end
+ def test_local_cache_of_read_returns_a_copy_of_the_entry
+ @cache.with_local_cache do
+ @cache.write(:foo, type: "bar")
+ value = @cache.read(:foo)
+ assert_equal("bar", value.delete(:type))
+ assert_equal({ type: "bar" }, @cache.read(:foo))
+ end
+ end
+
def test_local_cache_of_read
@cache.write("foo", "bar")
@cache.with_local_cache do