Sha256: 81ad1c12e9a0a9dee7fbb94431eaae479a5d78c512e7e64cfffc5a0ef5b4cc4e

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require 'super_hooks'

describe SuperHooks do
  it 'should have a VERSION constant' do
    expect(subject.const_get('VERSION')).not_to be_empty
  end

  describe '#installed?' do
    context 'in a git repository' do
      before(:each) do
        expect(SuperHooks::Git).to receive(:repository?).and_return true
        expect(SuperHooks::Git).to receive(:current_repository).and_return('/some/path/')
      end

      context 'with a hooks.old folder' do
        it 'returns true' do
          expect(File).to receive(:exist?).with('/some/path/.git/hooks.old/').and_return true
          expect(described_class.installed?).to be true
        end
      end

      context 'without a hooks.old folder' do
        it 'returns false' do
          expect(File).to receive(:exist?).with('/some/path/.git/hooks.old/').and_return false
          expect(described_class.installed?).to be false
        end
      end
    end

    context 'not in a repository' do
      it 'returns false' do
        expect(SuperHooks::Git).to receive(:repository?).and_return false
        expect(described_class.installed?).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_spec.rb