Sha256: 57a7222c19227edba4ea2d7ddda7d8a3c86aec4484a2cf9780ea57f343891a86

Contents?: true

Size: 1.34 KB

Versions: 19

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

module Convection::Control
  describe Stack do
    let(:template) do
      Convection.template do
        description 'EC2 VPC Test Template'

        ec2_vpc 'TargetVPC' do
          network '10.0.0.0'
          subnet_length 24
          enable_dns
        end
      end
    end

    describe 'before delete tasks' do
      include_context 'with a CollectAvailabilityZonesTask defined'
      include_context 'with a mock CloudFormation client'
      include_context 'with a mock EC2 client'

      before do
        allow(Aws::CloudFormation::Client).to receive(:new).and_return(cf_client)
        allow(Aws::EC2::Client).to receive(:new).and_return(ec2_client)
      end
      let(:task) { CollectAvailabilityZonesTask.new }
      subject do
        scope = self
        Convection::Control::Stack.new('EC2 VPC Test Stack', template) do
          before_delete_task scope.task
        end
      end

      it 'is registered before Stack#delete is called' do
        expect(subject.tasks[:before_delete]).to_not be_empty
      end

      it 'is executed on Stack#delete' do
        subject.delete

        expect(task.availability_zones).to include('eu-central-1')
      end

      it 'is deregistered after Stack#delete is called' do
        subject.delete

        expect(subject.tasks[:before_delete]).to be_empty
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
convection-1.0.2 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.1 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.0.pre.beta.10 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.0.pre.beta.9 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.0.pre.beta.8 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.0.pre.beta.7 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.0.pre.beta.6 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.0.pre.beta.4 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-1.0.0.pre.beta.1 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.4.3 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.4.2 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.4.1 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.4.0 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.3.3.pre.beta.1 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.3.2 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.3.1 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.3.0 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.2.34.pre.beta.1 spec/convection/control/stack/before_delete_tasks_spec.rb
convection-0.2.33 spec/convection/control/stack/before_delete_tasks_spec.rb