We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2e459c2 commit 07227afCopy full SHA for 07227af
tests/test_helper.rb
@@ -43,8 +43,11 @@ def create_temp_repo(clone_path)
43
end
44
45
def in_temp_dir(remove_after = true) # :yields: the temporary dir's path
46
- filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s.rjust(3, '0')
47
- tmp_path = File.join("/tmp/", filename)
+ tmp_path = nil
+ while tmp_path.nil? || File.directory?(tmp_path)
48
+ filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s.rjust(3, '0')
49
+ tmp_path = File.join("/tmp/", filename)
50
+ end
51
FileUtils.mkdir(tmp_path)
52
Dir.chdir tmp_path do
53
yield tmp_path
0 commit comments