Sha256: bea772e6107131fa4d41000fabc45072a3fab73db2fd9084c98c841e46c101ef

Contents?: true

Size: 1.08 KB

Versions: 68

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

class Convection::Model::Template::Resource
  describe Lambda do
    let(:template) do
      Convection.template do
        description 'Lambda Permission Test Template'

        lambda_permission 'LambdaInvokePermission' do
          action 'lambda:InvokeFunction'
          function_name get_att('MyLambdaFunction', 'Arn')
          principal 's3.amazonaws.com'
          source_account fn_ref('AWS::AccountId')
        end
      end
    end

    subject do
      template_json
        .fetch('Resources')
        .fetch('LambdaInvokePermission')
        .fetch('Properties')
    end

    it 'action parameter is set correctly' do
      expect(subject['Action']).to eq('lambda:InvokeFunction')
    end

    it 'function name parameter is set with get_att' do
      expect(subject['FunctionName']).to eq('Fn::GetAtt' => %w(MyLambdaFunction Arn))
    end

    it 'source account fn ref sets param properly' do
      expect(subject['SourceAccount']).to eq('Ref' => 'AWS::AccountId')
    end

    private

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

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
convection-1.1.3 spec/convection/model/template/resource/permission_spec.rb
convection-1.1.2 spec/convection/model/template/resource/permission_spec.rb
convection-1.1.1 spec/convection/model/template/resource/permission_spec.rb
convection-1.1.0 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.7 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.6 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.5 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.4 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.3 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.2 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.1 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.0.pre.beta.10 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.0.pre.beta.9 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.0.pre.beta.8 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.0.pre.beta.7 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.0.pre.beta.6 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.0.pre.beta.4 spec/convection/model/template/resource/permission_spec.rb
convection-1.0.0.pre.beta.1 spec/convection/model/template/resource/permission_spec.rb
convection-0.4.3 spec/convection/model/template/resource/permission_spec.rb
convection-0.4.2 spec/convection/model/template/resource/permission_spec.rb