Use tmpdir instead of tempfile for creating temporary repos in the test suite.

This commit is contained in:
Bart Kamphorst
2020-03-13 17:07:15 +01:00
parent e1a13aef1f
commit 4d549b1660
+4 -5
View File
@@ -6,6 +6,7 @@ require 'mocha/setup'
require 'fileutils'
require 'minitest/reporters'
require 'twitter_cldr'
require 'tmpdir'
# Silence locale validation warning
require 'i18n'
@@ -42,13 +43,11 @@ end
def cloned_testpath(path, bare = false)
repo = File.expand_path(testpath(path))
tmp = Tempfile.new(self.class.name)
path = tmp.path
tmpdir = Dir.mktmpdir(self.class.name)
bare = bare ? "--bare" : ""
tmp.close(true)
redirect = Gem.win_platform? ? '' : '2>/dev/null'
%x{git clone #{bare} #{repo} #{path} #{redirect}}
path
%x{git clone #{bare} '#{repo}' #{tmpdir} #{redirect}}
tmpdir
end
def commit_details