         @authDevice = sinon.stub().yields null, uuid: '1234'
         @getDevice = sinon.stub().yields null, uuid: '5431', owner: '1234'
         @securityImpl = canReceive: sinon.stub().yields null, true
-        @sut = new MeshbluWebsocketHandler authDevice: @authDevice, MessageIOClient: @MessageIOClient, securityImpl: @securityImpl, getDevice: @getDevice
+        @sut = new MeshbluWebsocketHandler authDevice: @authDevice, MessageIOClient: @MessageIOClient, securityImpl: @securityImpl, getDevice: @getDevice, meshbluEventEmitter: @meshbluEventEmitter
         @sut.messageIOClient = @messageIOClient
         @sut.sendFrame = sinon.spy()
 

    describe 'when rateLimit exceeded', ->
      beforeEach ->
        @throttles = query: rateLimit: sinon.stub().yields new Error('rate limit exceeded')
        @sut = new MeshbluWebsocketHandler throttles: @throttles
        @sut.socket = id: '1555', close: sinon.spy()
        @sut.sendError = sinon.spy()
        @sut.onMessage data: '["test",{"far":"near"}]'

        @authDevice = sinon.stub().yields null, something: true
        @getDevice = sinon.stub().yields null, uuid: '5431'
        @securityImpl = canReceive: sinon.stub().yields null, true
        @sut = new MeshbluWebsocketHandler authDevice: @authDevice, MessageIOClient: @MessageIOClient, securityImpl: @securityImpl, getDevice: @getDevice, meshbluEventEmitter: @meshbluEventEmitter
        @sut.messageIOClient = @messageIOClient
        @sut.sendFrame = sinon.spy()

