Sha256: 113668eb560ddc1837930458bacf126f66b5b0a927158b06f14269bf1e9b3c74

Contents?: true

Size: 1.45 KB

Versions: 10

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

class Convection::Model::Template
  describe self do
    let(:template) do
      Convection.template do
        description 'Test Template'

        ec2_instance 'TestInstance1' do
          availability_zone 'us-east-1'
          image_id 'ami-asdf83'
        end

        ec2_instance 'TestInstance2' do
          availability_zone 'us-west-1'
          image_id 'ami-lda34f'
          depends_on 'TestInstance1'
        end
      end
    end

    subject do
      template_json
    end

    it 'template format version is 2010-09-09 ' do
      expect(subject['AWSTemplateFormatVersion']).to eq('2010-09-09')
    end

    it 'Template descriptions are set correctly' do
      expect(subject['Description']).to eq('Test Template')
    end

    it 'template TestInstance1 has properties' do
      expect(subject['Resources']['TestInstance1']['Properties']).to_not eq(nil)
    end

    it 'TestInstance1 Type is AWS::EC2::Instance' do
      expect(subject['Resources']['TestInstance1']['Type']).to eq('AWS::EC2::Instance')
    end

    it 'DependsOn values are set correctly' do
      expect(subject['Resources']['TestInstance2']['DependsOn'][0]).to eq('TestInstance1')
    end

    it { is_expected.to have_key('Parameters') }

    it { is_expected.to have_key('Mappings') }

    it { is_expected.to have_key('Conditions') }

    it { is_expected.to have_key('Resources') }

    private

    def template_json
      JSON.parse(template.to_json)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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