} }) Context("when the -r flag is provided", func() { Context("when deleting routes succeeds", func() { It("deletes the app's routes", func() { runCommand("-f", "-r", "app-to-delete") Expect(routeRepo.DeletedRouteGuids).To(ContainElement("the-first-route-guid")) Expect(routeRepo.DeletedRouteGuids).To(ContainElement("the-second-route-guid")) }) }) Context("when deleting routes fails", func() { BeforeEach(func() { routeRepo.DeleteErr = errors.New("badness") }) It("fails with the api error message", func() { runCommand("-f", "-r", "app-to-delete") Expect(ui.Outputs).To(ContainSubstrings( []string{"Deleting", "app-to-delete"}, []string{"FAILED"}, )) }) }) }) Context("when the -r flag is not provided", func() { It("does not delete mapped routes", func() {