Sha256: f5b99863fe42eed7b6542dbb1be9030d81fe9d4881715d5c7ab1775d2d17875f

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Minimart::Download::GitRepository do

  let(:location) { 'http://github.com' }

  subject do
    Minimart::Download::GitRepository.new(location)
  end

  describe '#fetch' do
    let(:repo) do
      instance_double('Git::Base',
        fetch:      true,
        reset_hard: true,
        revparse:   'master')
    end

    let(:path) { '/git_path' }

    before(:each) do
      allow_any_instance_of(Minimart::Download::GitCache).to receive(:get_repository).with(location).and_return repo
      allow_any_instance_of(Minimart::Download::GitCache).to receive(:local_path_for).with(location).and_return path
      allow(Git).to receive(:clone).with(path, an_instance_of(String)).and_return repo
    end

    it 'should clone the repo' do
      expect(repo).to receive(:reset_hard).with('master')
      subject.fetch('master')
    end

    it 'should yield the directory the repo was cloned to' do
      expect { |b|
        subject.fetch('master', &b)
      }.to yield_with_args(an_instance_of(String))
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
minimart-1.2.5 spec/lib/minimart/download/git_repository_spec.rb
minimart-1.2.4 spec/lib/minimart/download/git_repository_spec.rb
minimart-1.2.3 spec/lib/minimart/download/git_repository_spec.rb
minimart-1.2.0 spec/lib/minimart/download/git_repository_spec.rb
minimart-1.1.6 spec/lib/minimart/download/git_repository_spec.rb
minimart-1.1.3 spec/lib/minimart/download/git_repository_spec.rb
minimart-1.0.2 spec/lib/minimart/download/git_repository_spec.rb
minimart-1.0.1 spec/lib/minimart/download/git_repository_spec.rb
minimart-0.0.1 spec/lib/minimart/download/git_repository_spec.rb