Sha256: 73f81eb534f29a853cf7417f90ed4282253d0fd7417d8becb0afd84822d31ff7

Contents?: true

Size: 1.53 KB

Versions: 68

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

class Convection::Model::Template::Resource
  describe Lambda do
    let(:template) do
      Convection.template do
        description 'VPC Endpoint Test Template'

        ec2_vpc_endpoint 'TestVpcEndpoint' do
          service 's3'
          vpc 'vpc-foo'
          route_tables %w(table1 table2)

          allow do
            s3_resource 'bucket-bar', '*'
            action 's3:GetObject'
          end
        end
      end
    end

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

    it 'vpc endpoint config is not nil' do
      expect(subject).to_not eq(nil)
    end

    it 'vpc is correctly defined' do
      expect(subject['VpcId']).to eq('vpc-foo')
    end

    it 'ServiceName is a hash' do
      expect(subject['ServiceName']).to be_a(Hash)
    end

    # "ServiceName"=>
    #   {"Fn::Join"=>[".", ["com.amazonaws", {"Ref"=>"AWS::Region"}, "s3"]]},
    it 'ServiceName Fn::Join is a array' do
      expect(subject['ServiceName']['Fn::Join']).to be_a(Array)
    end

    it 'ServiceName Fn::Join array index 0 is correctly defined' do
      expect(subject['ServiceName']['Fn::Join'][0]).to eq('.')
    end

    it 'ServiceName s3 path is an array' do
      expect(subject['ServiceName']['Fn::Join'][1]).to be_a(Array)
    end

    it 'ServiceName s3 path last element is s3' do
      expect(subject['ServiceName']['Fn::Join'][1].last).to eq('s3')
    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/vpc_endpoints_spec.rb
convection-2.3.0 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.29 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.28.pre.beta.2 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.28.pre.beta.1 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.27 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.26 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.25 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.24 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.23 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.22 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.21 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.20 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.19 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.18 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.17 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.16 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.15 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.14 spec/convection/model/template/resource/vpc_endpoints_spec.rb
convection-2.2.13 spec/convection/model/template/resource/vpc_endpoints_spec.rb