diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-07-01 16:56:43 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-07-01 16:56:43 -0700 |
commit | ee7d4c47e7abf1e5ec8f4d4a1e937cdee5bb8d9c (patch) | |
tree | de8bce11c912a72a20cf67709aaa010efd6bc6f8 /activesupport/test | |
parent | 92bff2ebf122252cf3ff64160bdfa9891fcff3f4 (diff) | |
download | rails-ee7d4c47e7abf1e5ec8f4d4a1e937cdee5bb8d9c.tar.gz rails-ee7d4c47e7abf1e5ec8f4d4a1e937cdee5bb8d9c.tar.bz2 rails-ee7d4c47e7abf1e5ec8f4d4a1e937cdee5bb8d9c.zip |
Fixes bug where Memcached connections get corrupted when an invalid expire is passed in [#2854 state:resolved]
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/caching_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 928af256f4..7667f11343 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -1,3 +1,4 @@ +require 'logger' require 'abstract_unit' require 'active_support/cache' @@ -190,6 +191,8 @@ uses_memcached 'memcached backed store' do @cache = ActiveSupport::Cache.lookup_store(:mem_cache_store) @data = @cache.instance_variable_get(:@data) @cache.clear + @cache.silence! + @cache.logger = Logger.new("/dev/null") end include CacheStoreBehavior @@ -312,6 +315,22 @@ uses_memcached 'memcached backed store' do app = @cache.middleware.new(app) app.call({}) end + + def test_expires_in + result = @cache.write('foo', 'bar', :expires_in => 1) + assert_equal 'bar', @cache.read('foo') + sleep 2 + assert_equal nil, @cache.read('foo') + end + + def test_expires_in_with_invalid_value + @cache.write('baz', 'bat') + assert_raise(RuntimeError) do + @cache.write('foo', 'bar', :expires_in => 'Mon Jun 29 13:10:40 -0700 2150') + end + assert_equal 'bat', @cache.read('baz') + assert_equal nil, @cache.read('foo') + end end class CompressedMemCacheStore < ActiveSupport::TestCase |