summaryrefslogtreecommitdiffstats
path: root/tests/test_helper.rb
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-12 17:58:02 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-12 17:58:02 -0800
commitf590869eaa6a4c7f25a1df8eca171a119fcee7ed (patch)
treea946f572fc3c9f6cbaef60331a2c6ef7db2b86f1 /tests/test_helper.rb
parent852a0e63d294de874c3311f5e7edf40e2f2ecd60 (diff)
downloadthird_party-ruby-git-f590869eaa6a4c7f25a1df8eca171a119fcee7ed.tar.gz
third_party-ruby-git-f590869eaa6a4c7f25a1df8eca171a119fcee7ed.tar.xz
third_party-ruby-git-f590869eaa6a4c7f25a1df8eca171a119fcee7ed.zip
added the tree functions and tests
Diffstat (limited to 'tests/test_helper.rb')
-rw-r--r--tests/test_helper.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/test_helper.rb b/tests/test_helper.rb
index 78328c9..9907ffe 100644
--- a/tests/test_helper.rb
+++ b/tests/test_helper.rb
@@ -22,17 +22,18 @@ class Test::Unit::TestCase
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
@@ -40,7 +41,7 @@ class Test::Unit::TestCase
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