aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
diff options
context:
space:
mode:
authorDmitry Polushkin <dmitry.polushkin@gmail.com>2011-10-01 20:49:14 +0100
committerDmitry Polushkin <dmitry.polushkin@gmail.com>2011-10-01 20:49:14 +0100
commit19965402b2f868c79d78269ca17cb6282f271382 (patch)
tree8635415f386595650c27469d6b6d04335121d070 /activesupport/test/caching_test.rb
parent9d54f8994d09db5435d6c234430ae13333928fb9 (diff)
parentec53b802dab9b676dcc9b53e542bcd840983b7a2 (diff)
downloadrails-19965402b2f868c79d78269ca17cb6282f271382.tar.gz
rails-19965402b2f868c79d78269ca17cb6282f271382.tar.bz2
rails-19965402b2f868c79d78269ca17cb6282f271382.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activesupport/test/caching_test.rb')
-rw-r--r--activesupport/test/caching_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index 6bb13ec9b8..b692a41312 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -357,7 +357,7 @@ module CacheStoreBehavior
def test_really_long_keys
key = ""
- 1000.times{key << "x"}
+ 900.times{key << "x"}
assert_equal true, @cache.write(key, "bar")
assert_equal "bar", @cache.read(key)
assert_equal "bar", @cache.fetch(key)
@@ -557,6 +557,15 @@ class FileStoreTest < ActiveSupport::TestCase
key = @cache_with_pathname.send(:key_file_path, "views/index?id=1")
assert_equal "views/index?id=1", @cache_with_pathname.send(:file_path_key, key)
end
+
+ # Because file systems have a maximum filename size, filenames > max size should be split in to directories
+ # If filename is 'AAAAB', where max size is 4, the returned path should be AAAA/B
+ def test_key_transformation_max_filename_size
+ key = "#{'A' * ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE}B"
+ path = @cache.send(:key_file_path, key)
+ assert path.split('/').all? { |dir_name| dir_name.size <= ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE}
+ assert_equal 'B', File.basename(path)
+ end
end
class MemoryStoreTest < ActiveSupport::TestCase