Sha256: 1efeb09b8ab469f3ac2a46380ad2dcdbb7a5dcfc1c54892e9256dea441754525

Contents?: true

Size: 1.21 KB

Versions: 68

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

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

        # TODO: Test simple properties of EventsRule as well?
        events_rule 'MyEventsRule' do
          event_pattern 'source', %w(aws.ec2)
          event_pattern 'detail',
                        'state' => %w(shutting-down stopped stopping terminated),
                        'instance-id' => 'i-deadb33f'
          event_pattern 'detail-type', ['EC2 Instance State-change Notification']
        end
      end
    end

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

    it 'combines all event pattern calls into a single event pattern JSON object' do
      expect(subject['EventPattern']).to include(
        'source' => %w(aws.ec2),
        'detail' => {
          'state' => %w(shutting-down stopped stopping terminated),
          'instance-id' => 'i-deadb33f'
        },
        'detail-type' => ['EC2 Instance State-change Notification']
      )
    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-2.3.1 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.3.0 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.29 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.28.pre.beta.2 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.28.pre.beta.1 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.27 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.26 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.25 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.24 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.23 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.22 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.21 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.20 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.19 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.18 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.17 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.16 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.15 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.14 spec/convection/model/template/resource/events_rule_spec.rb
convection-2.2.13 spec/convection/model/template/resource/events_rule_spec.rb