Sha256: c6806ad2942553fa272f753d9c3b5ac8165e5e098d5a63998f92a07fb2ff057d

Contents?: true

Size: 1.04 KB

Versions: 68

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

class Convection::Model::Template::Resource
  describe EC2Subnet do
    let(:template) do
      Convection.template do
        description 'Ec2 Subnet'

        ec2_subnet 'PublicSubnet' do
          network '10.10.11.0/24'
          availability_zone 'us-east-1a'
          tag 'Name', 'subnet'
          vpc fn_ref('DemoVPC')
          public_ips true
        end
      end
    end

    subject do
      template_json
        .fetch('Resources')
        .fetch('PublicSubnet')
        .fetch('Properties')
    end

    it 'sets the cidr block' do
      expect(subject['CidrBlock']).to eq('10.10.11.0/24')
    end

    it 'sets the availability zone' do
      expect(subject['AvailabilityZone']).to eq('us-east-1a')
    end

    it 'sets a subnet as public' do
      expect(subject['MapPublicIpOnLaunch']).to be(true)
    end

    it 'sets tags' do
      expect(subject['Tags']).to include(hash_including('Key' => 'Name', 'Value' => 'subnet'))
    end

    private

    def template_json
      JSON.parse(template.to_json)
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
convection-2.3.1 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.3.0 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.29 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.28.pre.beta.2 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.28.pre.beta.1 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.27 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.26 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.25 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.24 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.23 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.22 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.21 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.20 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.19 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.18 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.17 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.16 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.15 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.14 spec/convection/model/template/resource/ec2_subnet_spec.rb
convection-2.2.13 spec/convection/model/template/resource/ec2_subnet_spec.rb