コード例 #1
0
ファイル: ui_test.go プロジェクト: rajkumargithub/lattice
			_, passwordReaderOk := terminalUI.(password_reader.PasswordReader)
			Expect(passwordReaderOk).To(BeTrue())
		})
	})

	Describe("Output methods", func() {
		Describe("Say", func() {
			It("says the message to the terminal", func() {
				terminalUI.Say("Cloudy with a chance of meatballs")
				Expect(outputBuffer).To(test_helpers.Say("Cloudy with a chance of meatballs"))
			})
		})

		Describe("SayLine", func() {
			It("says the message to the terminal with a newline", func() {
				terminalUI.SayLine("Strange Clouds")
				Expect(outputBuffer).To(test_helpers.Say("Strange Clouds\n"))
			})
		})

		Describe("SayIncorrectUsage", func() {
			Context("when no message is passed", func() {
				It("outputs incorrect usage", func() {
					terminalUI.SayIncorrectUsage("")
					Expect(outputBuffer).To(test_helpers.SayIncorrectUsage())
				})
			})
			Context("when a message is passed", func() {
				It("outputs incorrect usage with the message", func() {
					terminalUI.SayIncorrectUsage("You did that thing wrong")
					Expect(outputBuffer).To(test_helpers.Say("Incorrect Usage: You did that thing wrong"))
コード例 #2
0
			It("says the message to the terminal", func() {
				terminalUI.Say("Cloudy with a chance of meatballs")
				Expect(outputBuffer).To(test_helpers.Say("Cloudy with a chance of meatballs"))
			})

			Context("when printf-style syntax is used", func() {
				It("says the formatted message to the terminal", func() {
					terminalUI.Say("delim %s what %d", "put-this-in", 44)
					Expect(outputBuffer).To(test_helpers.Say("delim put-this-in what 44"))
				})
			})
		})

		Describe("SayLine", func() {
			It("says the message to the terminal with a newline", func() {
				terminalUI.SayLine("Strange Clouds")
				Expect(outputBuffer).To(test_helpers.Say("Strange Clouds\n"))
			})

			Context("when printf-style syntax is used", func() {
				It("says the formatted message to the terminal", func() {
					terminalUI.SayLine("delim %s what %d", "put-this-in", 44)
					Expect(outputBuffer).To(test_helpers.Say("delim put-this-in what 44\n"))
				})
			})
		})

		Describe("SayIncorrectUsage", func() {
			Context("when no message is passed", func() {
				It("outputs incorrect usage", func() {
					terminalUI.SayIncorrectUsage("")