         it "Then error 404 should be returned", ->
             @response.statusCode.should.equal(404)
 
-    describe "Find a Note that does exist in database", ->
-        it "When I send a request to get Note with id 321", (done) ->
+    describe "Find a Document that does exist in database", ->
+        before ->
+            delete @body
+            delete @response
+
+        it "When I send a request to get Document with id 321", (done) ->
             client.get 'data/321/', (error, response, body) =>
                 response.should.be.json
                 response.statusCode.should.equal(200)



describe "Existence", ->
    describe "Check Existence of a Note that does not exist in database", ->
        it "When I send a request to check existence of Note with id 123", \
                (done) ->
            client.get "data/exist/123/", (error, response, body) =>
                response.should.be.json

db = connection.database('cozy')


# TEST SECTION #################################################################

before (done) ->
    # Prepare database for tests
    db.destroy ->
        console.log 'DB destroyed'
        db.create ->
            console.log 'DB recreated'
            db.save '321', {"value":"val"} # insert id 321 : Existence

    # start app
    app.listen(8888)
