var _ = Describe("Event Stream Handlers", func() {
	var (
		logger  lager.Logger
		fakeBBS *fake_bbs.FakeClient

		handler *handlers.EventStreamHandler

		server *httptest.Server
	)

	BeforeEach(func() {
		fakeBBS = new(fake_bbs.FakeClient)
		logger = lager.NewLogger("test")
		logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))

		handler = handlers.NewEventStreamHandler(fakeBBS, logger)
	})

	AfterEach(func(done Done) {
		if server != nil {
			server.Close()
		}
		close(done)
	})

	Describe("EventStream", func() {
		var (
			request         *http.Request
			responseChan    chan *http.Response
			eventStreamDone chan struct{}
		)
	var (
		logger lager.Logger
		hub    event.Hub

		handler *handlers.EventStreamHandler

		server *httptest.Server
	)

	BeforeEach(func() {
		hub = event.NewHub()

		logger = lager.NewLogger("test")
		logger.RegisterSink(lager.NewWriterSink(GinkgoWriter, lager.DEBUG))

		handler = handlers.NewEventStreamHandler(hub, logger)
	})

	AfterEach(func() {
		hub.Close()

		if server != nil {
			server.Close()
		}
	})

	Describe("EventStream", func() {
		var (
			response        *http.Response
			eventStreamDone chan struct{}
		)