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.3.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.3.0 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.29 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.28.pre.beta.2 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.28.pre.beta.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.27 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.26 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.25 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.24 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.23 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.22 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.21 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.20 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.19 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.18 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.17 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.16 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.15 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.14 spec/convection/model/template/validate_bytesize_spec.rb
convection-2.2.13 spec/convection/model/template/validate_bytesize_spec.rb