コード例 #1
0
ファイル: events_handlers_test.go プロジェクト: Gerg/bbs
	var (
		logger lager.Logger
		hub    events.Hub

		handler *handlers.EventHandler

		server *httptest.Server
	)

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

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

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

	AfterEach(func() {
		hub.Close()

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

	Describe("Subscribe", func() {
		var (
			response        *http.Response
			eventStreamDone chan struct{}
		)
コード例 #2
0
ファイル: events_handlers_test.go プロジェクト: timani/bbs
var _ = Describe("Event Handlers", func() {
	var (
		logger     lager.Logger
		desiredHub events.Hub
		actualHub  events.Hub

		handler         *handlers.EventHandler
		eventStreamDone chan struct{}
		server          *httptest.Server
	)

	BeforeEach(func() {
		logger = lagertest.NewTestLogger("test")
		desiredHub = events.NewHub()
		actualHub = events.NewHub()
		handler = handlers.NewEventHandler(logger, desiredHub, actualHub)

		eventStreamDone = make(chan struct{})
	})

	AfterEach(func() {
		desiredHub.Close()
		actualHub.Close()
		server.Close()
	})

	var ItStreamsEventsFromHub = func(hubRef *events.Hub) {
		Describe("Streaming Events", func() {
			var hub events.Hub
			var response *http.Response