Sha256: 14af850958fe5557cbae1c87f51655f6d21f4c70cef4dc3055d3ccb6299127e4

Contents?: true

Size: 911 Bytes

Versions: 1

Compression:

Stored size: 911 Bytes

Contents

require 'spec_helper'

describe SuperHooks::Git do
  let(:git) { described_class }

  context 'in a git repository' do
    describe '#repository' do
      it 'returns the current repository path' do
        expect(git.repository?).to be true
        expect(git).to receive(:`).with('git rev-parse --show-toplevel 2>&1').and_return '/top/level/git/folder'
        expect(git.repository).to eql '/top/level/git/folder'
      end
    end
  end

  context 'not in a repository' do
    before(:each) do
      expect(git).to receive(:`).with('git rev-parse --show-toplevel 2>&1').and_raise SuperHooks::Git::GitError
    end
    describe '#repository' do
      it 'raises not a directory' do
        expect { git.repository }.to raise_error described_class::NotARepository
      end
    end

    describe '#repository?' do
      it 'is false' do
        expect(git.repository?).to be false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
super_hooks-0.0.2.1 spec/lib/super_hooks/git_spec.rb