   describe 'EVENT mydevices', ->
     describe 'when called with a valid request', ->
       beforeEach (done) ->
+        @eventForwarder.on 'message', (@message) =>
+          done() if @message.topic == 'devices'
+
         @meshblu.register owner: @device.uuid, =>
           @meshblu.mydevices {}, =>
-            @eventForwarder.once 'message', (@message) =>
-              done()
 
       it 'should send a "devices" message', ->
         expect(@message.topic).to.deep.equal 'devices'


    describe 'when called with an invalid request', ->
      beforeEach (done) ->
        @meshblu.device {uuid: 'invalid-uuid'}, (data) =>
          return done new Error(data.error) if data.error?
          @eventForwarder.once 'message', (@message) =>
            done()

      it 'should send a "devices-error" message', ->
        expect(@message.topic).to.deep.equal 'devices-error'


    describe 'when called with an invalid request', ->
      beforeEach (done) ->
        @eventForwarder.on 'message', (@message) =>
          done() if @message.topic == 'getpublickey-error'
        @meshblu.getPublicKey 'invalid-uuid', (error) =>

      it 'should send an "getpublickey-error" message', ->
        expect(@message.topic).to.deep.equal 'getpublickey-error'
