예제 #1
0
				Eventually(outputBuffer).Should(test_helpers.Say("Nickname: "))
				stdinWriter.Write([]byte("RockStar\n"))

				Eventually(answerChan).Should(Receive(Equal("RockStar")))
				Eventually(answerChan).Should(BeClosed())
			})
		})

		Describe("PromptWithDefault", func() {
			It("Prompts the user for input", func() {
				answerChan := make(chan string)
				go func() {
					defer GinkgoRecover()

					answerChan <- terminalUI.PromptWithDefault("Nickname", "x")
					close(answerChan)
				}()

				Eventually(outputBuffer).Should(test_helpers.Say("Nickname [x]: "))
				stdinWriter.Write([]byte("RockStar\n"))

				Eventually(answerChan).Should(Receive(Equal("RockStar")))
				Eventually(answerChan).Should(BeClosed())
			})

			It("Prompts the user for input and uses the default value if enter is pressed", func() {
				answerChan := make(chan string)
				go func() {
					defer GinkgoRecover()