Sha256: e50b0c91bcda98c8b3e7161d1862db507bf9fab85f1a016e304cee899430184d

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

require 'helper'

describe Gitrb do
  it 'should fail to initialize without a valid git repository' do
    File.exists?('/foo').should.be.false
    lambda do
      Gitrb::Repository.new(:path => '/foo', :branch => 'master', :bare => true)
    end.should.raise(ArgumentError)
    File.exists?('/foo').should.be.false
    lambda do
      Gitrb::Repository.new(:path => '/foo', :branch => 'master')
    end.should.raise(ArgumentError)
    File.exists?('/foo').should.be.false
  end

  it 'should create repository on relative path' do
    FileUtils.rm_rf('/tmp/gitrb_test')
    Dir.chdir('/tmp') do
      Gitrb::Repository.new(:path => "gitrb_test/repo",
                            :bare => true, :create => true)
    end
    File.directory?('/tmp/gitrb_test/repo').should.be.true
    File.directory?('/tmp/gitrb_test/repo/objects').should.be.true
    File.exists?('/tmp/gitrb_test/repo/.git').should.be.false

    FileUtils.rm_rf('/tmp/gitrb_test')
    Dir.chdir('/tmp') do
      Gitrb::Repository.new(:path => "gitrb_test/repo", :create => true)
    end
    File.directory?('/tmp/gitrb_test/repo').should.be.true
    File.directory?('/tmp/gitrb_test/repo/.git').should.be.true
    File.directory?('/tmp/gitrb_test/repo/.git/objects').should.be.true
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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