_, 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"))
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("")