     it 'should first look for testacular files', ->
       handler new httpMock.ServerRequest('/_testacular_/'), response
 
-      # TODO(vojta): refactor to waitForFinishingResponseAnd ->
-      waitForFinishingResponse()
-
-      runs ->
+      waitForFinishingResponseAnd ->
         expect(response._body).toEqual 'CLIENT HTML'
         expect(response._status).toBe 200
         expect(actualOptions).toEqual {}


      retVal = tcularSrcHandler new httpMock.ServerRequest('/_testacular_/context.html'), response
      expect(retVal).toBeTruthy()
      waitForFinishingResponse()

      runs ->
        expect(response._body).toEqual 'CONTEXT\n' +
        '<script type="text/javascript" src="/absolute/some/abs/a.js?12345"></script>\n' +
        '<script type="text/javascript" src="/base/b.js?67890"></script>\n' +

    it 'should redirect urlRoot without trailing slash', ->
      retVal = tcularSrcHandler new httpMock.ServerRequest('/_testacular_'), response
      expect(retVal).toBe true
      waitForFinishingResponseAnd ->
        expect(response._status).toBe 301
        expect(response._headers['Location']).toBe '/_testacular_/'

