@@ -12,10 +12,10 @@ def test_expand_cache_key_with_rails_cache_id
12
12
begin
13
13
ENV [ 'RAILS_CACHE_ID' ] = 'c99'
14
14
assert_equal 'c99/foo' , ActiveSupport ::Cache . expand_cache_key ( :foo )
15
- assert_equal 'c99/foo' , ActiveSupport ::Cache . expand_cache_key ( [ :foo ] )
15
+ assert_equal 'c99/c99/ foo' , ActiveSupport ::Cache . expand_cache_key ( [ :foo ] )
16
16
assert_equal 'c99/c99/foo/c99/bar' , ActiveSupport ::Cache . expand_cache_key ( [ :foo , :bar ] )
17
17
assert_equal 'nm/c99/foo' , ActiveSupport ::Cache . expand_cache_key ( :foo , :nm )
18
- assert_equal 'nm/c99/foo' , ActiveSupport ::Cache . expand_cache_key ( [ :foo ] , :nm )
18
+ assert_equal 'nm/c99/c99/ foo' , ActiveSupport ::Cache . expand_cache_key ( [ :foo ] , :nm )
19
19
assert_equal 'nm/c99/c99/foo/c99/bar' , ActiveSupport ::Cache . expand_cache_key ( [ :foo , :bar ] , :nm )
20
20
ensure
21
21
ENV [ 'RAILS_CACHE_ID' ] = nil
@@ -42,14 +42,33 @@ def test_expand_cache_key_rails_cache_id_should_win_over_rails_app_version
42
42
end
43
43
end
44
44
45
- def test_respond_to_cache_key
45
+ def test_expand_cache_key_respond_to_cache_key
46
46
key = 'foo'
47
47
def key . cache_key
48
48
:foo_key
49
49
end
50
50
assert_equal 'foo_key' , ActiveSupport ::Cache . expand_cache_key ( key )
51
51
end
52
52
53
+ def test_expand_cache_key_array_with_something_that_responds_to_cache_key
54
+ key = 'foo'
55
+ def key . cache_key
56
+ :foo_key
57
+ end
58
+ assert_equal 'foo_key' , ActiveSupport ::Cache . expand_cache_key ( [ key ] )
59
+ end
60
+
61
+ def test_expand_cache_key_of_nil
62
+ assert_equal '' , ActiveSupport ::Cache . expand_cache_key ( nil )
63
+ end
64
+
65
+ def test_expand_cache_key_of_false
66
+ assert_equal 'false' , ActiveSupport ::Cache . expand_cache_key ( false )
67
+ end
68
+
69
+ def test_expand_cache_key_of_true
70
+ assert_equal 'true' , ActiveSupport ::Cache . expand_cache_key ( true )
71
+ end
53
72
end
54
73
55
74
class CacheStoreSettingTest < ActiveSupport ::TestCase
0 commit comments