Describe("Instantiation", func() { It("instantiates a terminal", func() { Expect(terminalUI).ToNot(BeNil()) _, readWriterOk := terminalUI.(io.ReadWriter) Expect(readWriterOk).To(BeTrue()) _, 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("")
Describe("Instantiation", func() { It("instantiates a terminal", func() { Expect(terminalUI).NotTo(BeNil()) _, readWriterOk := terminalUI.(io.ReadWriter) Expect(readWriterOk).To(BeTrue()) _, 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")) }) 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"))