 
       it 'exit status should be 1', () ->
         assert.equal exitStatus, 1
-
-    describe "when server is not running", () ->
-
-      before (done) ->
-        cmd = "./bin/dredd ./test/fixtures/apiary.apib http://localhost:#{PORT} --no-color"
-        execCommand cmd, done
-
-      it 'exit status should be 1', () ->
-        assert.equal exitStatus, 1
-
-      it 'should return a understandable message', () ->
-        assert.include stdout, 'Error connecting'
-
-      it 'should report error for all transactions', () ->
-        occurences = (stdout.match(/Error connecting/g) || []).length
-        assert.equal occurences, 5
-
-      it 'should return stats', () ->
-        assert.include stdout, '5 errors'
-
-      #['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE']
 
   describe "when called with arguments", () ->
 


    it 'stdout shoud contain sandbox messagae', () ->
      assert.include stdout, 'Loading hookfiles in sandboxed context'

  # WARNING: this test is excluded from code coverage
  # it for some reason decreases coverage on local and in coveralls
  describe 'when using --server', () ->
    resourceRequested = false

    before (done) ->
      cmd = "./bin/dredd ./test/fixtures/single-get.apib http://localhost:#{PORT} --server ./test/fixtures/scripts/dummy-server.sh --no-color --server-wait=1"

      app = express()

      app.get '/machines', (req, res) ->
        resourceRequested = true
        res.setHeader 'Content-Type', 'application/json'
        machine =
          type: 'bulldozer'
          name: 'willy'
        response = [machine]
        res.status(200).send response


      server = app.listen PORT, () ->
        execCommand cmd, () ->
          server.close()

      server.on 'close', done

    it 'should hit the resource', () ->
      assert.ok resourceRequested

    it 'exit status should be 0', () ->
      assert.equal exitStatus, 0

    it 'stdout shoud contain fail message', () ->
      assert.include stdout, 'dummy server'



describe "Command line interface", () ->

  describe "Arguments with existing blueprint and responding server", () ->
    describe "when executing the command and the server is responding as specified in the blueprint", () ->

