Fix: FileStoreTest#test_filename_max_size fails in Ruby 2.5.1

This commit is contained in:
utilum 2018-03-30 23:53:23 +02:00 committed by Andrew White
parent f4680e4923
commit 0548d655f2
No known key found for this signature in database
GPG Key ID: 7E83729F16B086CF
1 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,9 @@ class FileStoreTest < ActiveSupport::TestCase
def test_filename_max_size
key = "#{'A' * ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE}"
path = @cache.send(:normalize_key, key, {})
Dir::Tmpname.create(path) do |tmpname, n, opts|
basename = File.basename(path)
dirname = File.dirname(path)
Dir::Tmpname.create(basename, Dir.tmpdir + dirname) do |tmpname, n, opts|
assert File.basename(tmpname + ".lock").length <= 255, "Temp filename too long: #{File.basename(tmpname + '.lock').length}"
end
end