Sha256: b0a14818cfa0332842f29bb66fa6c6b884a2403f5b90da12bd3d3e16ae3bb9e0

Contents?: true

Size: 1.48 KB

Versions: 10

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

class Convection::Model::Template
  describe '#validate_bytesize' do
    context 'with a regular Template bytesize' do
      subject do
        Convection.template do
          description 'Validations Test Template - Regular Bytesize'
        end
      end

      it 'does not raise an excessive description error' do
        rendered = subject.render
        expect { subject.validate(rendered) }.to_not raise_error
      end
    end

    context 'with excessive Template bytesize' do
      subject do
        Convection.template do
          description 'Validations Test Template - Excessive Bytesize'

          200.times do |count|
            resource "EC2_INSTANCE_#{count}" do
              type 'AWS::EC2::Instance'
              property 'AvailabilityZone', 'us-east-1a'
              property 'ImageId', 'ami-76e27e1e'
              property 'KeyName', 'test'
              property 'SecurityGroupIds', ['sg-dd733c41', 'sg-dd738df3']
              property 'Tags', [{ 'Key' => 'Name', 'Value' => 'test-1' }]
            end
          end

          80.times do |count|
            mapping "Mapping_#{count}" do
              item 'us-east-1', 'test', 'cf-test-keys'
              item 'us-west-1', 'test', 'cf-test-keys'
            end
          end
        end
      end

      it 'raises an excessive description error' do
        rendered = subject.render
        expect { subject.validate(rendered) }.to raise_error(ExcessiveTemplateSizeError)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
convection-0.4.3 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.4.2 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.4.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.4.0 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.3.3.pre.beta.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.3.2 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.3.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.3.0 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.2.34.pre.beta.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-0.2.33 spec/convection/model/template/validate_bytesize_spec.rb