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-1.1.3 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.1.2 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.1.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.1.0 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.7 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.6 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.5 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.4 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.3 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.2 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.1 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.0.pre.beta.10 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.0.pre.beta.9 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.0.pre.beta.8 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.0.pre.beta.7 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.0.pre.beta.6 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.0.pre.beta.4 spec/convection/model/template/validate_bytesize_spec.rb
convection-1.0.0.pre.beta.1 spec/convection/model/template/validate_bytesize_spec.rb