Sha256: 927414a573fa7daad8ee3df11fdc744907639d3f6ba3a6c6d746ce8f2e09c993

Contents?: true

Size: 617 Bytes

Versions: 7

Compression:

Stored size: 617 Bytes

Contents

require 'gitrb'

module TestHelper
  def ls_tree(id)
    repo.git_ls_tree(id).split("\n").map {|line| line.split(" ") }
  end

  def file(file, data)
    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}")
      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'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gitrb-0.2.8 test/helper.rb
gitrb-0.2.7 test/helper.rb
gitrb-0.2.6 test/helper.rb
gitrb-0.2.5 test/helper.rb
gitrb-0.2.4 test/helper.rb
gitrb-0.2.3 test/helper.rb
gitrb-0.2.2 test/helper.rb