         expect(@registerHandler.isDone).to.be.true
 
     context 'when whoami fails', ->
-      beforeEach ->
-        meshbluConfig = server: 'localhost', port: 0xd00d
-        @sut = new Verifier {meshbluConfig}
-
       beforeEach (done) ->
         @registerHandler = @meshblu.post('/devices')
           .send(type: 'meshblu:verifier')

        expect(@unregisterHandler.isDone).to.be.true

    context 'when register fails', ->
      beforeEach ->
        meshbluConfig = server: 'localhost', port: 0xd00d
        @sut = new Verifier {meshbluConfig}

      beforeEach (done) ->
        @registerHandler = @meshblu.post('/devices')
          .send(type: 'meshblu:verifier')

Verifier = require '../src/verifier'

describe 'Verifier', ->
  beforeEach (done) ->
    @meshblu = shmock done

  beforeEach ->
    meshbluConfig = server: 'localhost', port: @meshblu.address().port
    @sut = new Verifier {meshbluConfig}

  afterEach (done) ->
    @meshblu.close done

  describe '-> verify', ->
    context 'when everything works', ->
      beforeEach (done) ->
        @registerHandler = @meshblu.post('/devices')
          .send(type: 'meshblu:verifier')
