Sha256: c2301f0957ac3126874bc24d72b0787b81ea4c8dd0416db521b6ee1ed933ddc3

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe AwsAlertMonitor::EventClassifier do

  describe 'event' do

    context 'auto scaling notification' do
      let(:message) { fixture_file('asg_instance_launch.json') }
      let(:classifier) { AwsAlertMonitor::EventClassifier.new message }

      it 'returns the appropriate event object' do
        classifier.event.type.should == 'autoscaling:EC2_INSTANCE_LAUNCH'
      end
    end

    context 'cloud watch alarm' do
      let(:message) { fixture_file('cloud_watch_alarm.json') }
      let(:classifier) { AwsAlertMonitor::EventClassifier.new message }

      it 'returns the appropriate event object' do
        classifier.event.type.should == 'cloudwatch:AWS/SQS-ApproximateNumberOfMessagesVisible'
      end
    end

    context 'process down' do
      let(:message) { fixture_file('process_down.json') }
      let(:classifier) { AwsAlertMonitor::EventClassifier.new message }

      it 'returns the appropriate event object' do
        classifier.event.type.should == 'process_down'
      end
    end

    context 'unknown' do
      let(:message) { '{ "foo": "bar" }'}
      let(:classifier) { AwsAlertMonitor::EventClassifier.new message }

      it 'returns the appropriate event object' do
        classifier.event.type.should == 'unknown'
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws-alert-monitor-0.1.0 spec/event_classifier_spec.rb