     ops = options()
     ops.body =
       name: 'deleted-project'
-      userId: testUserId
+      userId: testUser.id
       createdDate: new Date()
     request.post (base '/projects'), ops, (e,r,b)->
       r.statusCode.should.be.equal 200


testProjects = [ {name: 'p1'}, {name: 'p2'} ]

testUserId = undefined
projectsCreated = []

createTestUser = (cb)->
  ops = options()
  ops.body =
    firstName: 'Test'
    lastName: 'ProjectUser'
    email: "testProjectUser#{uuid.v1()}@testProjectUser.com"
    password: 'testing projects!'
  testUser = ops.body
  request.post (base '/users'), ops, (e,r,b)->
    cb null, b.id

createProject = (project, callback)->
  ops = options()

describe 'Projects', ->
  before (done) ->
    startApp ->
      user_test_helper.makeUser (user)->
        testUser = user
        testProjects = _.map testProjects, (p)->
          p.createdDate = new Date()
          p.userId = user.id
          return p
        async.each testProjects, createProject, done

  after (done) ->
    async.each projectsCreated, deleteProject, ->
      ops = options()
      request.del (base "/users/#{testUser.id}"), ops, (e,r,b)->
        r.statusCode.should.be.equal 200
        done()

