aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2012-01-27 20:41:37 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2012-01-27 20:44:08 +0100
commit83dbef6074269c3eb742c0506476b3679707dedd (patch)
tree46c0cf37bbcc7dc4c4cadfd2ae1ffc1a1ede9b00 /activesupport/test
parent69816a830bb2f5c0df1f8f4a6f97fd951e5edb9d (diff)
downloadrails-83dbef6074269c3eb742c0506476b3679707dedd.tar.gz
rails-83dbef6074269c3eb742c0506476b3679707dedd.tar.bz2
rails-83dbef6074269c3eb742c0506476b3679707dedd.zip
Revert "Fix expanding cache key for single element arrays"
This reverts commit abe915f23777efe10f17d611bf5718ca855a0704. This broke all existing keys and it's wrong anyway. The array is just there as a convenience option for building the string. It's intentional that [ "stuff"] and "stuff" generates the same key.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/caching_test.rb22
1 files changed, 7 insertions, 15 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index 3454c378d3..b03865da93 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -4,19 +4,19 @@ require 'active_support/cache'
class CacheKeyTest < ActiveSupport::TestCase
def test_expand_cache_key
- assert_equal 'Array/1/2/true', ActiveSupport::Cache.expand_cache_key([1, '2', true])
- assert_equal 'name/Array/1/2/true', ActiveSupport::Cache.expand_cache_key([1, '2', true], :name)
+ assert_equal '1/2/true', ActiveSupport::Cache.expand_cache_key([1, '2', true])
+ assert_equal 'name/1/2/true', ActiveSupport::Cache.expand_cache_key([1, '2', true], :name)
end
def test_expand_cache_key_with_rails_cache_id
begin
ENV['RAILS_CACHE_ID'] = 'c99'
assert_equal 'c99/foo', ActiveSupport::Cache.expand_cache_key(:foo)
- assert_equal 'c99/Array/foo', ActiveSupport::Cache.expand_cache_key([:foo])
- assert_equal 'c99/Array/foo/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar])
+ assert_equal 'c99/foo', ActiveSupport::Cache.expand_cache_key([:foo])
+ assert_equal 'c99/foo/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar])
assert_equal 'nm/c99/foo', ActiveSupport::Cache.expand_cache_key(:foo, :nm)
- assert_equal 'nm/c99/Array/foo', ActiveSupport::Cache.expand_cache_key([:foo], :nm)
- assert_equal 'nm/c99/Array/foo/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar], :nm)
+ assert_equal 'nm/c99/foo', ActiveSupport::Cache.expand_cache_key([:foo], :nm)
+ assert_equal 'nm/c99/foo/bar', ActiveSupport::Cache.expand_cache_key([:foo, :bar], :nm)
ensure
ENV['RAILS_CACHE_ID'] = nil
end
@@ -55,7 +55,7 @@ class CacheKeyTest < ActiveSupport::TestCase
def key.cache_key
:foo_key
end
- assert_equal 'Array/foo_key', ActiveSupport::Cache.expand_cache_key([key])
+ assert_equal 'foo_key', ActiveSupport::Cache.expand_cache_key([key])
end
def test_expand_cache_key_of_nil
@@ -69,14 +69,6 @@ class CacheKeyTest < ActiveSupport::TestCase
def test_expand_cache_key_of_true
assert_equal 'true', ActiveSupport::Cache.expand_cache_key(true)
end
-
- def test_expand_cache_key_of_one_element_array_different_than_key_of_element
- element = 'foo'
- array = [element]
- element_cache_key = ActiveSupport::Cache.expand_cache_key(element)
- array_cache_key = ActiveSupport::Cache.expand_cache_key(array)
- assert_not_equal element_cache_key, array_cache_key
- end
end
class CacheStoreSettingTest < ActiveSupport::TestCase