aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-12 11:32:45 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-12 11:32:45 -0700
commitcdc10c898d4865302740340eedec4f5f4ca76565 (patch)
tree3906eeeb6d002af30d0042f402ce924a34be2374 /activesupport/test
parent0fbb797e5f667443e49f3c3a2b370eb00dc48951 (diff)
parentaccd4926cc072217bc98b82368d20fb8f79a8bca (diff)
downloadrails-cdc10c898d4865302740340eedec4f5f4ca76565.tar.gz
rails-cdc10c898d4865302740340eedec4f5f4ca76565.tar.bz2
rails-cdc10c898d4865302740340eedec4f5f4ca76565.zip
Merge pull request #12196 from h-lame/fix-activesupport-cache-filestore-cleanup
Fix FileStore#cleanup to no longer rely on missing each_key method
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/caching_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index df570d485a..16d087ab9d 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -709,6 +709,18 @@ class FileStoreTest < ActiveSupport::TestCase
@cache.send(:read_entry, "winston", {})
assert @buffer.string.present?
end
+
+ def test_cleanup_removes_all_expired_entries
+ time = Time.now
+ @cache.write('foo', 'bar', expires_in: 10)
+ @cache.write('baz', 'qux')
+ @cache.write('quux', 'corge', expires_in: 20)
+ Time.stubs(:now).returns(time + 15)
+ @cache.cleanup
+ assert_not @cache.exist?('foo')
+ assert @cache.exist?('baz')
+ assert @cache.exist?('quux')
+ end
end
class MemoryStoreTest < ActiveSupport::TestCase