         receiveAction newAction, 'user:error', check, done
         send actionIn, action, payload
     describe 'without user and with invalid grant code in URL', ->
-      xhr = null
+      mock = null
       code = null
       beforeEach ->
         code = 'dj0328hf3d9cq3c'
-        xhr = sinon.fakeServer.create()
+        mock = sinon.fakeServer.create()
       afterEach ->
-        xhr.restore()
+        mock.restore()
       it 'should perform a token exchange and fail', (done) ->
         action = 'application:url'
         payload = "https://app.flowhub.io?code=#{code}"

          chai.expect(data['grid-user']).to.eql userData
        receiveAction newAction, 'user:info', check, done
        send actionIn, action, payload
        xhr.respondWith 'GET', "https://noflo-gate.herokuapp.com/authenticate/#{code}", (req) ->
          req.respond 200,
            'Content-Type': 'application/json'
          , JSON.stringify
            token: token
        xhr.respondWith 'GET', "https://api.flowhub.io/user", (req) ->
          req.respond 200,
            'Content-Type': 'application/json'
          , JSON.stringify userData
        do xhr.respond
        do xhr.respond
  describe 'receiving user:login action', ->
    describe 'with app URL not matching redirect configuration', ->
      it 'should send user:error', (done) ->

            token: token
          plan:
            type: 'free'
        mock = sinon.fakeServer.create()
      afterEach ->
        mock.restore()
      it 'should perform a token exchange and update user information', (done) ->
        action = 'application:url'
        payload = "https://app.flowhub.io?code=#{code}"
