summaryrefslogtreecommitdiffstats
path: root/tests/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_helper.rb')
-rw-r--r--tests/test_helper.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/test_helper.rb b/tests/test_helper.rb
index 4a1cac9..fe8c34d 100644
--- a/tests/test_helper.rb
+++ b/tests/test_helper.rb
@@ -5,9 +5,18 @@ require File.dirname(__FILE__) + '/../lib/git'
class Test::Unit::TestCase
def set_file_paths
- @wdir = File.join(File.dirname(__FILE__), 'files', 'working')
- @wbare = File.join(File.dirname(__FILE__), 'files', 'working.git')
- @index = File.join(File.dirname(__FILE__), 'files', 'index')
+ cwd = `pwd`.chomp
+ if File.directory?(File.join(cwd, 'files'))
+ @test_dir = File.join(cwd, 'files')
+ elsif File.directory?(File.join(cwd, '..', 'files'))
+ @test_dir = File.join(cwd, '..', 'files')
+ elsif File.directory?(File.join(cwd, 'tests', 'files'))
+ @test_dir = File.join(cwd, 'tests', 'files')
+ end
+
+ @wdir = File.join(@test_dir, 'working')
+ @wbare = File.join(@test_dir, 'working.git')
+ @index = File.join(@test_dir, 'index')
end
def in_temp_dir