 
             it "Then it returns a 404 error", ->
                 @response.statusCode.should.equal 404
-

should = require('chai').Should()
async = require('async')
Client = require('request-json').JsonClient



    describe "indexing and searching", ->
        it "Given I index four notes", (done) =>
            async.series [
                createNoteFunction "Note 01", "little stories begin"
                createNoteFunction "Note 02", "great dragons are coming"
                createNoteFunction "Note 03", "small hobbits are afraid"
                createNoteFunction "Note 04", "such as humans"
            ], =>
                done()
            
        it "When I send a request to search the notes with dragons", (done) ->
            data = ids: [dragonNoteId]
            indexer = fakeServer data, 200, (url, body) ->
                if url is '/index/'
                    should.exist body.fields
                    should.exist body.doc
                    should.exist body.doc.docType

            indexer.listen 9102

            client.post "data/search/note", { query: "dragons" }, \
                    (error, response, body) =>
                @result = body
                indexer.close()
                done()

        it "Then result is the second note I created", ->
