icinga-hubot-script
Version:
A hubot script that takes notification messages from Icinga and post them to any IRC channel
66 lines (54 loc) • 2.19 kB
text/coffeescript
chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
MessageCreator = require '../src/message_creator'
describe 'MessageCreator', ->
beforeEach ->
= new MessageCreator()
=
hostname: ->
return 'any hostname'
hostState: ->
return 1
serviceState: ->
return 2
serviceDescription: ->
return 'service description'
isHostNotification: ->
return false
isServiceNotification: ->
return false
isProblem: ->
return false
isRecovery: ->
return false
describe 'messages()', ->
describe 'isProblem', ->
beforeEach ->
.isProblem = ->
return true
it 'message should contain problem message', ->
expect(.messages()).to.match(/Houston/)
it 'message should contains the hostname if it is a host notification', ->
.isHostNotification = ->
return true
expect(.messages()).to.match(/any hostname/)
it 'message should contains the service name if it is a service notification', ->
.isServiceNotification = ->
return true
expect(.messages()).to.match(/service description/)
describe 'isRecovery', ->
beforeEach ->
.isRecovery = ->
return true
it 'message should contain problem message', ->
expect(.messages()).to.match(/Problem solved/)
it 'message should contains the hostname if it is a host notification', ->
.isHostNotification = ->
return true
expect(.messages()).to.match(/any hostname/)
it 'message should contains the service name if it is a service notification', ->
.isServiceNotification = ->
return true
expect(.messages()).to.match(/service description/)