)

var _ = Describe("NozzlePlugin", func() {
	Describe(".Run", func() {
		var fakeCliConnection *fakes.FakeCliConnection
		var nozzlerCmd *NozzlerCmd
		var fakeFirehose *testhelpers.FakeFirehose

		BeforeEach(func() {
			fakeFirehose = testhelpers.NewFakeFirehose(ACCESS_TOKEN)
			fakeFirehose.SendLog("Log Message")
			fakeFirehose.Start()

			fakeCliConnection = &fakes.FakeCliConnection{}
			fakeCliConnection.AccessTokenReturns(ACCESS_TOKEN, nil)
			fakeCliConnection.DopplerEndpointReturns(fakeFirehose.URL(), nil)
			nozzlerCmd = &NozzlerCmd{}
		})

		AfterEach(func() {
			fakeFirehose.Close()
		})

		It("works", func(done Done) {
			defer close(done)
			outputChan := make(chan []string)
			go func() {
				output := io_helpers.CaptureOutput(func() {
					nozzlerCmd.Run(fakeCliConnection, []string{"nozzle", "--debug"})
				})
				outputChan <- output