Sha256: 359b5e42d0fa3296443248bd9c66eb9c628c2003de1831285184eb0f34ae91a4

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

  describe 'blazing setup' do

    before :each do
      setup_sandbox
      @config = Blazing::Config.new
      @config.target :production, "#{@sandbox_directory}/target"
      @config.target :staging, "#{@sandbox_directory}/staging"
      @cli = Blazing::CLI.new
      Blazing::Config.stub(:parse).and_return @config
    end

    after :each do
      teardown_sandbox
    end

    context 'when a target is specified' do

      before :each do
        capture(:stdout, :stderr) { @cli.setup(:production) }
      end

      it 'prepares the repository on the target location' do
        File.exists?("#{@sandbox_directory}/target/.git").should be true
      end

      it 'configures the repository to allow pushing to the checked out branch' do
        Grit::Repo.new("#{@sandbox_directory}/target").config['receive.denycurrentbranch'].should == 'ignore'
      end
    end

    context 'when all is specified as target' do
      it 'updates all targets' do
        capture(:stdout, :stderr) { @cli.setup('all') }
        File.exists?("#{@sandbox_directory}/target/.git/hooks/post-receive").should be true
        File.exists?("#{@sandbox_directory}/staging/.git/hooks/post-receive").should be true
      end
    end

 end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blazing-0.2.10 spec/blazing/integration/setup_spec.rb
blazing-0.2.9 spec/blazing/integration/setup_spec.rb