 
         it "Then the id of the new document should be returned", ->
             @body.should.have.property '_id'
+            @_id = @body._id
 
+        it "Then the Document should exist in Database", (done) ->
+            client.get "data/exist/" + @_id + "/", (error, response, body) =>
+                @body = parseBody response, body
+                @body.exist.should.be.true
+                done()
+
+        it "Then the Document in DB should equal the sent Document", (done) ->
+            client.get "data/" + @_id + "/", (error, response, body) =>
+                @body = parseBody response, body
+                @body.should.have.property 'value', @randomValue
+                done()


    describe "Create a new Document with a given id", ->
        before cleanRequest

        it "When I send a request to create a document with id 987", (done) ->
            client.post 'data/987/', {"value":"created value"}, \
                        (error, response, body) =>
                response.statusCode.should.equal 201
                @body = parseBody response, body

        it "Then { _id: '987' } should be returned", ->
            @body.should.have.property '_id', '987'

        it "Then the Document with id 987 should exist in Database", (done) ->
            client.get "data/exist/987/", (error, response, body) =>
                @body = parseBody response, body
                @body.exist.should.be.true
                done()

        it "Then the Document in DB should equal the sent Document", (done) ->
            client.get "data/987/", (error, response, body) =>
                @body = parseBody response, body
                @body.should.have.property 'value', @randomValue
                done()

    describe "Create a new Document without an id", ->
        before cleanRequest
        after ->
            delete @randomValue
            delete @_id

        it "When I send a request to create a document without an id", (done) ->
            @randomValue = randomString()
            client.post 'data/', {"value":@randomValue}, \
                        (error, response, body) =>
                response.statusCode.should.equal(201)
                @body = parseBody response, body
