diff options
author | Kohei Suzuki <eagletmt@gmail.com> | 2015-04-09 00:04:56 +0900 |
---|---|---|
committer | Kohei Suzuki <eagletmt@gmail.com> | 2015-04-09 00:04:56 +0900 |
commit | 16d7cfb17788bdb9e3bd80d6403e98ac515e539c (patch) | |
tree | e821d5a79900a26db58ba40b6020eb50d2c0fb7b /activesupport/test/caching_test.rb | |
parent | 0a120a818d413c64ff9867125f0b03788fc306f8 (diff) | |
download | rails-16d7cfb17788bdb9e3bd80d6403e98ac515e539c.tar.gz rails-16d7cfb17788bdb9e3bd80d6403e98ac515e539c.tar.bz2 rails-16d7cfb17788bdb9e3bd80d6403e98ac515e539c.zip |
Allow AS::Cache::FileStore#clear without cache directory
Currently `Rails.cache.clear` raises Errno::ENOENT if it's run just
after cloning a new Rails project. It should succeed without removing
files or directories.
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r-- | activesupport/test/caching_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb index 4953550c45..527538ed9a 100644 --- a/activesupport/test/caching_test.rb +++ b/activesupport/test/caching_test.rb @@ -684,6 +684,7 @@ class FileStoreTest < ActiveSupport::TestCase def teardown FileUtils.rm_r(cache_dir) + rescue Errno::ENOENT end def cache_dir @@ -703,6 +704,11 @@ class FileStoreTest < ActiveSupport::TestCase assert File.exist?(filepath) end + def test_clear_without_cache_dir + FileUtils.rm_r(cache_dir) + @cache.clear + end + def test_long_keys @cache.write("a"*10000, 1) assert_equal 1, @cache.read("a"*10000) |