Sha256: 2f72d7ff4470b0d556e36b12faf037b82da2595242abc716681783bda1856d0b

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

require 'spec_helper'
require 'git_tracker/repository'

describe GitTracker::Repository do
  subject(:repository) { described_class }
  let(:git_command) { 'git rev-parse --show-toplevel' }
  before do
    allow_message_expectations_on_nil
    repository.stub(:`).with(git_command) { "/path/to/git/repo/root\n" }
  end

  describe '.root' do

    it 'gets the path to the top-level directory of the local Repository' do
      $?.stub(:exitstatus) { 0 }
      expect(repository.root).to eq('/path/to/git/repo/root')
    end

    it 'aborts when not in a git repository' do
      $?.stub(:exitstatus) { 128 }
      expect { repository.root }.to_not succeed
    end
  end

  describe '.ensure_exists' do
    it 'aborts when not in a git repository' do
      $?.stub(:exitstatus) { 128 }
      expect { repository.root }.to_not succeed
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git_tracker-1.6.1 spec/git_tracker/repository_spec.rb
git_tracker-1.6.0 spec/git_tracker/repository_spec.rb