spec/lib/flapjack/data/event_spec.rb in flapjack-0.8.6 vs spec/lib/flapjack/data/event_spec.rb in flapjack-0.8.7

- old
+ new

@@ -12,14 +12,15 @@ let(:event_data) { {'type' => 'service', 'state' => 'critical', 'entity' => entity_name, 'check' => check, 'time' => time.to_i, - 'summary' => "timeout", + 'summary' => 'timeout', 'details' => "couldn't access", 'acknowledgement_id' => '1234', - 'duration' => (60 * 60) } + 'duration' => (60 * 60), + 'tags' => ['dev'] } } context 'class' do it "returns the next event (blocking, archiving)" do @@ -147,11 +148,11 @@ :archive_events => false, :redis => mock_redis) expect(result).to be_nil end end - ['time', 'details', 'acknowledgement_id', 'duration'].each do |optional_key| + ['time', 'details', 'acknowledgement_id', 'duration', 'tags'].each do |optional_key| it "rejects an event with invalid '#{optional_key}' key (archiving)" do bad_event_data = event_data.clone bad_event_data[optional_key] = {'hello' => 'there'} bad_event_json = bad_event_data.to_json expect(mock_redis).to receive(:brpoplpush). @@ -298,9 +299,12 @@ expect(event.state).to eq(event_data['state']) expect(event.duration).to eq(event_data['duration']) expect(event.time).to eq(event_data['time']) expect(event.id).to eq('xyz-example.com:ping') expect(event.type).to eq('service') + expect(event.tags).to be_an_instance_of(Flapjack::Data::TagSet) + expect(event.tags).to include('dev') + expect(event.tags).to_not include('prod') expect(event).to be_a_service expect(event).to be_a_service expect(event).not_to be_an_acknowledgement expect(event).not_to be_a_test_notifications