Beispiel #1
0
						},
					}
					routeRepo.FindReturns(route, nil)
				})

				It("tries to unbind the route from the app", func() {
					cmd.Execute(flagContext)
					Expect(routeRepo.UnbindCallCount()).To(Equal(1))
					routeGUID, appGUID := routeRepo.UnbindArgsForCall(0)
					Expect(routeGUID).To(Equal("route-guid"))
					Expect(appGUID).To(Equal("fake-app-guid"))
				})

				Context("when unbinding the route from the app fails", func() {
					BeforeEach(func() {
						routeRepo.UnbindReturns(errors.New("unbind-err"))
					})

					It("panics and prints a failure message", func() {
						Expect(func() { cmd.Execute(flagContext) }).To(Panic())
						Expect(ui.Outputs).To(BeInDisplayOrder(
							[]string{"FAILED"},
							[]string{"unbind-err"},
						))
					})
				})

				Context("when unbinding the route from the app succeeds", func() {
					BeforeEach(func() {
						routeRepo.UnbindReturns(nil)
					})