Sha256: be42da3d6b7df98db78d17839ea08f93324dae29faf2208065ced473b73a5841

Contents?: true

Size: 1.49 KB

Versions: 35

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'

describe Travis::CLI::Setup::Service do
  subject :service do
    repository = double('repository',{:slug => 'test_slug'})
    setup = double('Setup', :repository => repository)
    described_class.new(setup)
  end
  
  describe '#deploy' do
  
    subject :deploy_config do
      {'provider' => 'dummy'}
    end
    
    before do
      allow(service).to receive(:configure).and_yield(deploy_config)
      allow(service).to receive(:on).and_return(nil)
    end
  
    context 'with no existing deploy section' do
    
      it 'creates section contents without optional items' do
        service.send(:deploy, 'dummy') { |_| }
        expect(deploy_config).to include(
            'provider'      => 'dummy',
            'skip_cleanup'   => 'true'
        )
      end
    end
    
    context 'with existing deploy section' do
      it 'doesn\'t overwrite existing skip_cleanup' do
        deploy_config['skip_cleanup']='false'
        service.send(:deploy, 'dummy') { |_| }
        expect(deploy_config).to include('skip_cleanup'   => 'false')
      end

      it 'doesn\'t set skip_cleanup for v2' do
        deploy_config['edge']='true'
        service.send(:deploy, 'dummy') { |_| }
        expect(deploy_config).not_to include('skip_cleanup')
      end
      
      it 'sets skip_cleanup for explicit v1' do
        deploy_config['edge']='false'
        service.send(:deploy, 'dummy') { |_| }
        expect(deploy_config).to include('skip_cleanup'   => 'true')
      end
    end
    
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
travis-1.11.1 spec/cli/setup/service_spec.rb
travis-1.11.0 spec/cli/setup/service_spec.rb
travis-1.10.1.travis.1341.9 spec/cli/setup/service_spec.rb
travis-1.10.1.travis.1321.9 spec/cli/setup/service_spec.rb
travis-1.10.1.travis.1312.9 spec/cli/setup/service_spec.rb
travis-1.10.1.travis.1311.9 spec/cli/setup/service_spec.rb
travis-1.10.1.travis.1305.9 spec/cli/setup/service_spec.rb
travis-1.10.0 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1304.9 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1303.9 spec/cli/setup/service_spec.rb
travis-1.10.0.pre.rc4 spec/cli/setup/service_spec.rb
travis-1.10.0.pre.rc3 spec/cli/setup/service_spec.rb
travis-1.10.0.pre.rc2 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1288.9 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1285.9 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1279.9 spec/cli/setup/service_spec.rb
travis-1.10.0.pre.rc1 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1254.9 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1236.9 spec/cli/setup/service_spec.rb
travis-1.9.2.travis.1224.9 spec/cli/setup/service_spec.rb