It("prints out route does not exist", func() { runCommand("some-silly-route", "some-non-real-domain") Expect(ui.Outputs).To(ContainSubstrings( []string{"Checking for route..."}, []string{"FAILED"}, []string{"Domain not found"}, )) }) }) Context("when checking if the route exists returns an error", func() { BeforeEach(func() { requirementsFactory.LoginSuccess = true requirementsFactory.TargetedOrgSuccess = true routeRepo.CheckIfExistsError = errors.New("Some stupid error") }) It("prints out route does not exist", func() { runCommand("some-silly-route", "some-non-real-domain") Expect(ui.Outputs).To(ContainSubstrings( []string{"Checking for route..."}, []string{"FAILED"}, []string{"Some stupid error"}, )) }) }) })