Sha256: 635de053a052a13c40acc0308e871dde7d104215c1590c874a3b6217702644db

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'

module Blazing

  describe Repository do

    let(:shell_probe) { double(:shell, :run => nil) }

    describe '#setup' do
      it 'initializes and sets up the repository over ssh' do
        target = double(:target, :host => 'host', :user => 'user', :path => '/some/where')
        repository = Repository.new(target)
        repository.instance_variable_set(:@shell, shell_probe)

        shell_probe.should_receive(:run).with("ssh user@host 'mkdir /some/where; cd /some/where && git init && cd /some/where && git config receive.denyCurrentBranch ignore'")
        repository.setup
      end

      it 'initializes and sets up the repository locally when no host provided' do
        target = double(:target, :host => nil, :user => 'user', :path => '/some/where')
        repository = Repository.new(target)
        repository.instance_variable_set(:@shell, shell_probe)

        shell_probe.should_receive(:run).with("mkdir /some/where; cd /some/where && git init && cd /some/where && git config receive.denyCurrentBranch ignore")
        repository.setup
      end
    end

    describe '#add_git_remote' do

      let(:target) { double(:target, :host => 'host', :user => 'user', :path => '/some/where', :name => :foo, :location => '/url/for/git/remote') }
      let(:repository) { Repository.new(target) }
      let(:grit_object) { repository.instance_variable_get(:@grit_object) }

      it 'adds a git remote for the target' do
        repository.add_git_remote
        grit_object.config["remote.#{target.name}.url"].should == target.location
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blazing-0.4.2 spec/blazing/repository_spec.rb
blazing-0.4.1 spec/blazing/repository_spec.rb
blazing-0.4.0 spec/blazing/repository_spec.rb
blazing-0.4.0.beta3 spec/blazing/repository_spec.rb
blazing-0.4.0.beta2 spec/blazing/repository_spec.rb
blazing-0.4.0.beta1 spec/blazing/repository_spec.rb
blazing-0.3.0 spec/blazing/repository_spec.rb
blazing-0.2.14 spec/blazing/repository_spec.rb
blazing-0.2.13 spec/blazing/repository_spec.rb
blazing-0.2.12 spec/blazing/repository_spec.rb
blazing-0.2.11 spec/blazing/repository_spec.rb