         error err, req, res, next
 
     it 'should respond 400', ->
-      res.json.should.have.been.calledWith 400
+      res.status.should.have.been.calledWith 400
 
     it 'should respond with JSON', ->
-      res.json.should.have.been.called
+      json.should.have.been.called
 
     it 'should set the Cache-Control header', ->
       res.headers['Cache-Control'].should.equal 'no-store'


        req = {}

        res =
          status: sinon.spy()
          json: sinon.spy()
          set: sinon.spy (headers) -> res.headers = headers
          render: sinon.spy()
          redirect: sinon.spy()

  describe 'with no error status code', ->

    before ->
        send = sinon.spy()
        status = sinon.stub().returns { send: send }

        err = {}
        req = {}
        res = { status: status }
        next = sinon.spy()
        error err, req, res, next

    it 'should respond 500', ->
      res.status.should.have.been.calledWith 500

    it 'should respond with error message', ->
      send.should.have.been.calledWith 'Internal Server Error'
