Sha256: c71880d9cdc27f4cdfebe8e694779590fe8a9dce1af3bc468623a9a1df124942

Contents?: true

Size: 1022 Bytes

Versions: 1

Compression:

Stored size: 1022 Bytes

Contents

require_relative '../../helper'

module GitDuplicator
  describe MirrorDuplicator do
    let(:path) { '/somepath' }
    let(:from) do
      double(name: 'somename', bare_clone: nil, mirror: nil, url: 'somewhere1')
    end
    let(:options) { { clone_path: path, force_create_destination: true } }
    let(:to) { double(delete: nil, create: nil, url: 'somewhere2') }
    let(:duplicator) { described_class.new(from, to, options) }

    describe '#clone_source' do
      it 'bare clones the source repo' do
        expect(from).to receive(:bare_clone).with(path)
        duplicator.perform
      end
    end

    describe '#mirror' do
      it 'mirrors from bare clone to destination' do
        expect(from).to receive(:mirror).with(to.url)
        duplicator.perform
      end
    end

    describe '#clean_up' do
      it 'mirrors from bare clone to destination' do
        expect(FileUtils).to receive(:rm_rf)
        .with("#{duplicator.clone_path}/#{from.name}")
        duplicator.perform
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_duplicator-1.0.0 spec/git_duplicator/duplicator/mirror_duplicator_spec.rb