aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r--activesupport/test/caching_test.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index b1b6de0613..5c844b8122 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -12,10 +12,10 @@ class CacheKeyTest < ActiveSupport::TestCase
begin
ENV['RAILS_CACHE_ID'] = 'c99'
assert_equal 'c99/foo', ActiveSupport::Cache.expand_cache_key(:foo)
- assert_equal 'c99/foo', ActiveSupport::Cache.expand_cache_key([:foo])
+ assert_equal 'c99/c99/foo', ActiveSupport::Cache.expand_cache_key([:foo])
assert_equal 'c99/c99/foo/c99/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar])
assert_equal 'nm/c99/foo', ActiveSupport::Cache.expand_cache_key(:foo, :nm)
- assert_equal 'nm/c99/foo', ActiveSupport::Cache.expand_cache_key([:foo], :nm)
+ assert_equal 'nm/c99/c99/foo', ActiveSupport::Cache.expand_cache_key([:foo], :nm)
assert_equal 'nm/c99/c99/foo/c99/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar], :nm)
ensure
ENV['RAILS_CACHE_ID'] = nil
@@ -50,6 +50,14 @@ class CacheKeyTest < ActiveSupport::TestCase
assert_equal 'foo_key', ActiveSupport::Cache.expand_cache_key(key)
end
+ def test_array_with_something_that_responds_to_cache_key
+ key = 'foo'
+ def key.cache_key
+ :foo_key
+ end
+ assert_equal 'foo_key', ActiveSupport::Cache.expand_cache_key([key])
+ end
+
end
class CacheStoreSettingTest < ActiveSupport::TestCase