       .end (err, res) ->
         throw err if err
         assert.equal res.body.documents.length, 20
-        for doc in res.body.documents
+        for doc in res.body.documents when doc.status isnt 'Slettet'
+          count++
           do (doc) ->
             req.get('/turer/' + doc._id + '?api_key=dnt')
               .expect(200)
               .end (err, r) ->
                 throw err if err
                 assert.equal r.body.tags[0], 'Hytte'
-                done() if ++count is res.body.documents.length
+                done() if --count is 0
 
   it 'should list items with not given tag in first position', (done) ->
     count = 0

            assert.equal res.body.total, 101, 'there should be total of 101 documents in collection'
            done()

  it 'should insert multiple objects in collection and return ObjectIDs', (done) ->
    docs = [
      {name: 'foo'}
      {name: 'bar'}
    ]
    req.post('/turer?api_key=dnt').send(docs)
      .expect(201)
      .end (err, res) ->
        throw err if err
        assert.equal res.body.documents.length, 2
        assert.equal res.body.count, 2
        assert.equal typeof res.body.documents[0], 'string'
        assert.equal typeof res.body.documents[1], 'string'
        done()

  it 'should handle rapid requests to collection', (done) ->
    count = 0
    target = 200
    for i in [1..target]
      req.post('/turer?api_key=dnt').send({num:i}).expect(201).end (err, res) ->
        throw err if err
        assert.equal res.body.documents.length, 1
        assert.equal res.body.count, 1
        assert.equal typeof res.body.documents[0], 'string'
        done() if ++count is target

  it 'should convert _id to ObjectID if provided with one', (done) ->
    doc = _id: new ObjectID().toString(), name: 'tuut-tuut'
    req.post('/turer?api_key=dnt').send(doc).expect(201).end (err, res) ->
      throw err if err
      assert.equal res.body.documents[0], doc._id
      done()

  it 'should update existing document', (done) ->
    doc = {_id: data[50]._id, navn: 'foo'}
    req.post('/turer?api_key=dnt').send(doc).expect(201).end (err, res) ->
      throw err if err
      assert.equal res.body.documents[0], doc._id
      done()

  it 'should return error for missing request body', (done) ->
    req.post('/turer?api_key=dnt')
      .expect(400, done)

describe 'PUT', ->
  it 'should not be implemeted', (done) ->

      .end (err, res) ->
        throw err if err
        assert.equal res.body.documents.length, 20
        for doc in res.body.documents when doc.status isnt 'Slettet'
          count++
          do (doc) ->
            req.get('/turer/' + doc._id + '?api_key=dnt')
              .expect(200)
              .end (err, r) ->
                throw err if err
                assert.equal r.body.tags[0], 'Sted'
                done() if --count is 0

describe 'POST', ->
  it 'should insert single object in collection and return ObjectID', (done) ->
    doc = name: 'Tur til Bergen', lisens: 'CC BY-NC 3.0 NO', status: 'Offentlig'
    req.post('/turer?api_key=dnt').send(doc)
      .expect(201)
      .end (err, res) ->
        throw err if err
        assert.equal res.body.count, 1
        assert.equal typeof res.body.document, 'object'

        req.get('/turer?api_key=dnt')
          .expect(200)
