diff options
author | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-11 17:11:19 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-11 17:11:19 -0800 |
commit | 31b4f2b80616f570c83ed62d20f8b14ec5ba425b (patch) | |
tree | 57202ceb4c563ba5a53bc32e4c4e6ff90ecf7ba7 /tests/test_helper.rb | |
parent | 907b03949bab53e2f7d55094100a71abd22f23e7 (diff) | |
download | third_party-ruby-git-31b4f2b80616f570c83ed62d20f8b14ec5ba425b.tar.gz third_party-ruby-git-31b4f2b80616f570c83ed62d20f8b14ec5ba425b.tar.xz third_party-ruby-git-31b4f2b80616f570c83ed62d20f8b14ec5ba425b.zip |
adding my testing git directory
Diffstat (limited to 'tests/test_helper.rb')
-rw-r--r-- | tests/test_helper.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/test_helper.rb b/tests/test_helper.rb index c55e1f4..78328c9 100644 --- a/tests/test_helper.rb +++ b/tests/test_helper.rb @@ -14,9 +14,29 @@ class Test::Unit::TestCase @test_dir = File.join(cwd, 'tests', 'files') end - @wdir = File.expand_path(File.join(@test_dir, 'working')) + @wdir_dot = File.expand_path(File.join(@test_dir, 'working')) @wbare = File.expand_path(File.join(@test_dir, 'working.git')) @index = File.expand_path(File.join(@test_dir, 'index')) + + @wdir = create_temp_repo(@wdir_dot) + end + + def teardown + if @wdir + FileUtils.rm_r(@wdir) + 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') + Dir.chdir(tmp_path) do + FileUtils.mv('dot_git', '.git') + end + tmp_path end def in_temp_dir(remove_after = true) |