}) }) }) Context("when there are not routes", func() { It("tells the user when no routes were found", func() { runCommand() testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Getting routes"}, {"No routes found"}, }) }) }) Context("when there is an error listing routes", func() { BeforeEach(func() { routeRepo.ListErr = true }) It("returns an error to the user", func() { runCommand() testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Getting routes"}, {"FAILED"}, }) }) }) })
testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Getting routes", "my-user"}, {"host", "domain", "apps"}, {"hostname-1", "example.com", "dora"}, {"hostname-2", "cookieclicker.co", "dora", "bora"}, }) }) It("tells the user when no routes were found", func() { context := testcmd.NewContext("routes", []string{}) testcmd.RunCommand(cmd, context, reqFactory) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Getting routes"}, {"No routes found"}, }) }) It("reports an error when finding routes fails", func() { repo.ListErr = true context := testcmd.NewContext("routes", []string{}) testcmd.RunCommand(cmd, context, reqFactory) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"Getting routes"}, {"FAILED"}, }) }) })