runCommand("foo.com") Expect(domainRepo.DeleteDomainGuid).To(Equal("foo-guid")) testassert.SliceContains(ui.Prompts, testassert.Lines{ {"really delete the domain foo.com"}, }) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Deleting domain", "foo.com", "my-user"}, {"OK"}, }) }) Context("when there is an error deleting the domain", func() { BeforeEach(func() { domainRepo.DeleteApiResponse = errors.New("failed badly") }) It("show the error the user", func() { runCommand("foo.com") Expect(domainRepo.DeleteDomainGuid).To(Equal("foo-guid")) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Deleting domain", "foo.com"}, {"FAILED"}, {"foo.com"}, {"failed badly"}, }) }) })