Sha256: 0becb6ed981ab801f9901547c2431e07660d651e65dcdc48e59ae4b356182032

Contents?: true

Size: 1.35 KB

Versions: 68

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

class Convection::Model::Template::Resource
  describe RDSDBInstance do
    let(:template) do
      Convection.template do
        description 'RDS Test Template'

        rds_security_group 'MyRDSSecGroup' do
          description 'Pulls in EC2 SGs'
          ec2_security_group 'MyEC2SecGroup', '123456789012'
          cidr_ip 'my_cidr_value'
        end
      end
    end

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

    it 'DBSecurityGroupIngress in a array' do
      expect(subject['DBSecurityGroupIngress']).to be_a(Array)
    end

    it 'ingress rules array contains 2 elements' do
      expect(subject['DBSecurityGroupIngress'].size).to eq(2)
    end

    it 'defines the cidr block correctly' do
      expect(subject['DBSecurityGroupIngress']).to include(hash_including('CIDRIP' => 'my_cidr_value'))
    end

    it 'defines EC2SecurityGroupName correctly' do
      expect(subject['DBSecurityGroupIngress']).to include(hash_including('EC2SecurityGroupName' => 'MyEC2SecGroup'))
    end

    it 'defines EC2SecurityGroupOwnerId correctly' do
      expect(subject['DBSecurityGroupIngress']).to include(hash_including('EC2SecurityGroupOwnerId' => '123456789012'))
    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/rds_security_groups_spec.rb
convection-2.3.0 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.29 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.28.pre.beta.2 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.28.pre.beta.1 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.27 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.26 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.25 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.24 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.23 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.22 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.21 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.20 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.19 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.18 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.17 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.16 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.15 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.14 spec/convection/model/template/resource/rds_security_groups_spec.rb
convection-2.2.13 spec/convection/model/template/resource/rds_security_groups_spec.rb