test/helper.rb in gitrb-0.2.1 vs test/helper.rb in gitrb-0.2.2
- old
+ new
@@ -9,15 +9,25 @@
Dir.chdir(repo.path[0..-6]) do
FileUtils.mkpath(File.dirname(file))
open(file, 'w') { |io| io << data }
repo.git_add(file)
- repo.git_commit('-m', 'added #{file}')
+ repo.git_commit('-m', "added #{file}")
File.unlink(file)
end
end
+
+ def with_git_dir
+ old_path = ENV['GIT_DIR']
+ ENV['GIT_DIR'] = repo.path
+ yield
+ ensure
+ ENV['GIT_DIR'] = old_path
+ end
end
class Bacon::Context
include TestHelper
attr_reader :repo
end
+
+REPO_PATH = '/tmp/gitrb_test'