Sha256: b3dbd7954698479761ce452132a9bd5021e00a3f1b939b88717b559351adcc05

Contents?: true

Size: 1.42 KB

Versions: 24

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'
require 'dpl/provider/cloud66'

describe DPL::Provider::Cloud66 do
  subject :provider do
    described_class.new(DummyContext.new, options)
  end

  let(:successful_response){ double(code: '200') }
  let(:not_found_response){ double(code: '404') }
  let(:options){ {} }

  describe :push_app do
    context 'with a successful response' do
      let(:options){ {:redeployment_hook => 'https://hooks.cloud66.com/stacks/redeploy/0101010101010101'} }

      example do
        provider.should_receive(:webhook_call).with('https', 'hooks.cloud66.com', 443, '/stacks/redeploy/0101010101010101').and_return(successful_response)
        provider.push_app
      end
    end

    context 'with a 404 response' do
      let(:options){ {:redeployment_hook => 'https://hooks.cloud66.com/stacks/redeploy/0101010101010101'} }

      it 'should raise an error' do
        provider.should_receive(:webhook_call).with('https', 'hooks.cloud66.com', 443, '/stacks/redeploy/0101010101010101').and_return(not_found_response)
        lambda { provider.push_app }.should raise_error(DPL::Error, "Redeployment failed [404]")
      end
    end

    context 'with missing redeployment_hook option' do
      it 'should raise an error' do
        lambda { provider.push_app }.should raise_error(DPL::Error, "missing redeployment_hook")
      end
    end
  end

  describe :needs_key? do
    example do
      provider.needs_key?.should == false
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
dpl-1.6.1.travis.447.1 spec/provider/cloud66_spec.rb
dpl-1.6.0 spec/provider/cloud66_spec.rb
dpl-1.5.11.travis.445.1 spec/provider/cloud66_spec.rb
dpl-1.5.11.travis.437.1 spec/provider/cloud66_spec.rb
dpl-1.5.11.travis.436.1 spec/provider/cloud66_spec.rb
dpl-1.5.11.travis.435.1 spec/provider/cloud66_spec.rb
dpl-1.5.11.travis.432.1 spec/provider/cloud66_spec.rb
dpl-1.5.11.travis.430.1 spec/provider/cloud66_spec.rb
dpl-1.5.11.travis.414.1 spec/provider/cloud66_spec.rb
dpl-1.5.10 spec/provider/cloud66_spec.rb
dpl-1.5.10.travis.413.1 spec/provider/cloud66_spec.rb
dpl-1.5.10.travis.402.1 spec/provider/cloud66_spec.rb
dpl-1.6.0.travis.399.1 spec/provider/cloud66_spec.rb
dpl-1.5.9 spec/provider/cloud66_spec.rb
dpl-1.5.9.travis.397.1 spec/provider/cloud66_spec.rb
dpl-1.5.9.travis.394.1 spec/provider/cloud66_spec.rb
dpl-1.5.9.travis.393.1 spec/provider/cloud66_spec.rb
dpl-1.5.9.travis.390.1 spec/provider/cloud66_spec.rb
dpl-1.5.9.travis.373.1 spec/provider/cloud66_spec.rb
dpl-1.5.9.travis.372.1 spec/provider/cloud66_spec.rb