tests/test_helper.rb in git-1.0.1 vs tests/test_helper.rb in git-1.0.2
- old
+ new
@@ -20,28 +20,29 @@
@wdir = create_temp_repo(@wdir_dot)
end
def teardown
- if @wdir
- FileUtils.rm_r(@wdir)
+ if @tmp_path
+ #puts "teardown #{@tmp_path}"
+ FileUtils.rm_r(@tmp_path)
end
end
def create_temp_repo(clone_path)
- filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s
- tmp_path = File.join("/tmp/", filename)
- FileUtils.mkdir_p(tmp_path)
- FileUtils.cp_r(clone_path, tmp_path)
- tmp_path = File.join(tmp_path, 'working')
+ filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s.rjust(3, '0')
+ @tmp_path = File.join("/tmp/", filename)
+ FileUtils.mkdir_p(@tmp_path)
+ FileUtils.cp_r(clone_path, @tmp_path)
+ tmp_path = File.join(@tmp_path, 'working')
Dir.chdir(tmp_path) do
FileUtils.mv('dot_git', '.git')
end
tmp_path
end
def in_temp_dir(remove_after = true)
- filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s
+ filename = 'git_test' + Time.now.to_i.to_s + rand(300).to_s.rjust(3, '0')
tmp_path = File.join("/tmp/", filename)
FileUtils.mkdir(tmp_path)
Dir.chdir tmp_path do
yield tmp_path
end
\ No newline at end of file