aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache/behaviors
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-01-07 13:49:02 -0500
committerGitHub <noreply@github.com>2019-01-07 13:49:02 -0500
commitcd16413ef3280a50c1b13b1ed7be1a907fad88d1 (patch)
treeddea7224f0ee93bc8229b395fc57d33b5ad80eb6 /activesupport/test/cache/behaviors
parent9cfcc067e626f0f1e220cc00a9f96622a936350d (diff)
parent94ecf95674f81c5590c8f08549208907b81e3bf8 (diff)
downloadrails-cd16413ef3280a50c1b13b1ed7be1a907fad88d1.tar.gz
rails-cd16413ef3280a50c1b13b1ed7be1a907fad88d1.tar.bz2
rails-cd16413ef3280a50c1b13b1ed7be1a907fad88d1.zip
Merge pull request #34700 from gmcgibbon/fetch_multi_key_order
Preserve key order of #fetch_multi
Diffstat (limited to 'activesupport/test/cache/behaviors')
-rw-r--r--activesupport/test/cache/behaviors/cache_store_behavior.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/test/cache/behaviors/cache_store_behavior.rb b/activesupport/test/cache/behaviors/cache_store_behavior.rb
index 9f54b1e7de..a696760bb2 100644
--- a/activesupport/test/cache/behaviors/cache_store_behavior.rb
+++ b/activesupport/test/cache/behaviors/cache_store_behavior.rb
@@ -130,7 +130,7 @@ module CacheStoreBehavior
assert_equal("fufu", @cache.read("fu"))
end
- def test_multi_with_objects
+ def test_fetch_multi_with_objects
cache_struct = Struct.new(:cache_key, :title)
foo = cache_struct.new("foo", "FOO!")
bar = cache_struct.new("bar")
@@ -142,6 +142,14 @@ module CacheStoreBehavior
assert_equal({ foo => "FOO!", bar => "BAM!" }, values)
end
+ def test_fetch_multi_returns_ordered_names
+ @cache.write("bam", "BAM")
+
+ values = @cache.fetch_multi("foo", "bar", "bam") { |key| key.upcase }
+
+ assert_equal(%w(foo bar bam), values.keys)
+ end
+
def test_fetch_multi_without_block
assert_raises(ArgumentError) do
@cache.fetch_multi("foo")