Sha256: 9c68af15f1437fda3f2780b0e37fa00aed8ee2528b72fec5d25402bc5c4d6b32

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require_relative '../../helper'

module GitDuplicator
  describe UpdateDuplicator do
    let(:path) { '/somepath' }
    let(:from) do
      double(name: 'somename', mirror_clone: nil, set_mirrored_remote: nil,
             update_mirrored: 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(:mirror_clone).with(path)
        duplicator.perform
      end
    end

    describe '#mirror' do
      it 'sets the remote for push' do
        expect(from).to receive(:set_mirrored_remote).with(to.url)
        duplicator.perform
      end

      it 'mirrors from mirror clone to destination' do
        expect(from).to receive(:update_mirrored)
        duplicator.perform
      end
    end

    describe '#clean_up' do
      it 'mirrors from bare clone to destination' do
        expect(duplicator.perform).to be_nil
      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/update_duplicator_spec.rb