diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-09-12 11:32:45 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-09-12 16:04:10 -0300 |
commit | c539c684aa0fc08769304746e1702aa1b4ddd4c8 (patch) | |
tree | 67dcf16ed3e3d4028c5e2f8c8a9ab136582a95fd /activesupport/test/caching_test.rb | |
parent | c9642e31b1a9f764fbf1ce85b38fa225ec5e6b42 (diff) | |
download | rails-c539c684aa0fc08769304746e1702aa1b4ddd4c8.tar.gz rails-c539c684aa0fc08769304746e1702aa1b4ddd4c8.tar.bz2 rails-c539c684aa0fc08769304746e1702aa1b4ddd4c8.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
Conflicts:
activesupport/CHANGELOG.md
activesupport/test/caching_test.rb
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r-- | activesupport/test/caching_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 6db1746672..243648d7f6 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -608,6 +608,18 @@ class FileStoreTest < ActiveSupport::TestCase ActiveSupport::Cache::FileStore.new('/test/cache/directory').delete_matched(/does_not_exist/) end 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 !@cache.exist?('foo') + assert @cache.exist?('baz') + assert @cache.exist?('quux') + end end class MemoryStoreTest < ActiveSupport::TestCase |