From 4d549b16603d787a282191aba8a1dba96db664c9 Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Fri, 13 Mar 2020 17:07:15 +0100 Subject: [PATCH] Use tmpdir instead of tempfile for creating temporary repos in the test suite. --- test/helper.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/helper.rb b/test/helper.rb index 85e4ce0c..dda0a37e 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -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