     describe 'when authDevice yields a device', ->
       beforeEach ->
         @authDevice = sinon.stub().yields null, something: true
-        @sut = new MeshbluWebsocketHandler authDevice: @authDevice, MessageIOClient: @MessageIOClient
+        @sut = new MeshbluWebsocketHandler authDevice: @authDevice, MessageIOClient: @MessageIOClient, meshbluEventEmitter: @meshbluEventEmitter
         @sut.messageIOClient = @messageIOClient
         @sut.sendFrame = sinon.spy()
 

    describe 'when register yields an error', ->
      beforeEach ->
        @registerDevice = sinon.stub().yields new Error
        @sut = new MeshbluWebsocketHandler registerDevice: @registerDevice
        @sut.sendError = sinon.spy()

        @sut.register foo: 'bar'

    describe 'when getDevices yields devices', ->
      beforeEach ->
        @getDevices = sinon.stub().yields [{uuid: '5431', color: 'green'}, {uuid: '1234', color: 'green'}]
        @sut = new MeshbluWebsocketHandler getDevices: @getDevices, meshbluEventEmitter: @meshbluEventEmitter
        @sut.authedDevice = {}
        @sut.sendFrame = sinon.spy()
        @sut.devices color: 'green'

