aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
diff options
context:
space:
mode:
authorAlexey Gaziev <alex.gaziev@gmail.com>2011-12-27 10:54:05 +0800
committerAlexey Gaziev <alex.gaziev@gmail.com>2011-12-27 10:54:05 +0800
commitf7b1906ed784940bda6f0c5173036de276867c1c (patch)
tree7f438b7fcd84af96d202139e47764a45bcc30b42 /activesupport/test/caching_test.rb
parentd7cfb636367f2f929d07ade9060d35a2cf7ad20b (diff)
downloadrails-f7b1906ed784940bda6f0c5173036de276867c1c.tar.gz
rails-f7b1906ed784940bda6f0c5173036de276867c1c.tar.bz2
rails-f7b1906ed784940bda6f0c5173036de276867c1c.zip
Safe getting value from cache entry
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r--activesupport/test/caching_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index 5488070d8c..3f41f80c3a 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -220,6 +220,21 @@ module CacheStoreBehavior
assert_equal false, @cache.read('foo')
end
+ def test_should_read_cached_numeric_from_previous_rails_versions
+ @old_cache = ActiveSupport::Cache::Entry.create( 1, Time.now )
+ assert_equal( 1, @old_cache.value )
+ end
+
+ def test_should_read_cached_hash_from_previous_rails_versions
+ @old_cache = ActiveSupport::Cache::Entry.create( {}, Time.now )
+ assert_equal( {}, @old_cache.value )
+ end
+
+ def test_should_read_cached_string_from_previous_rails_versions
+ @old_cache = ActiveSupport::Cache::Entry.create( 'string', Time.now )
+ assert_equal( 'string', @old_cache.value )
+ end
+
def test_read_multi
@cache.write('foo', 'bar')
@cache.write('fu', 'baz')