Sha256: b1e10683d8abe7d3a67b47b2d45c682c71c6ae04b6d1289583bbed365b451239

Contents?: true

Size: 1.4 KB

Versions: 58

Compression:

Stored size: 1.4 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|
            ec2_instance "EC2_INSTANCE_#{count}" do
              availability_zone 'us-east-1a'
              property 'ImageId', 'ami-76e27e1e'
              property 'KeyName', 'test'
              security_group 'sg-dd733c41'
              security_group 'sg-dd738df3'
              tag 'Name', '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

58 entries across 58 versions & 1 rubygems

Version Path
convection-2.2.12 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.11 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.10 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.9 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.8 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.7 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.6 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.5 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.4 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.3 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.2 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.0 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.1.2 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.1.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.1.0 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.0.0 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.1.7 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.1.5 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.1.4 spec/convection/model/template/validate_bytesize_spec.rb