It("tells the user it is unbinding the route service", func() { Expect(runCLIErr).NotTo(HaveOccurred()) Expect(ui.Outputs()).To(ContainSubstrings( []string{"Unbinding route", "from service instance"}, )) }) It("tries to unbind the route service", func() { Expect(runCLIErr).NotTo(HaveOccurred()) Expect(routeServiceBindingRepo.UnbindCallCount()).To(Equal(1)) }) Context("when unbinding the route service succeeds", func() { BeforeEach(func() { routeServiceBindingRepo.UnbindReturns(nil) }) It("says OK", func() { Expect(runCLIErr).NotTo(HaveOccurred()) Expect(ui.Outputs()).To(ContainSubstrings( []string{"OK"}, )) }) }) Context("when unbinding the route service fails because it was not bound", func() { BeforeEach(func() { routeServiceBindingRepo.UnbindReturns(errors.NewHTTPError(http.StatusOK, errors.InvalidRelation, "http-err")) })