Expect(routes).To(BeNil()) }) }) }) Describe("DeleteRoute", func() { Context("when the route exists", func() { BeforeEach(func() { fakeCloudControllerClient.DeleteRouteReturns(nil, nil) }) It("deletes the route", func() { _, err := actor.DeleteRoute("some-route-guid") Expect(err).NotTo(HaveOccurred()) Expect(fakeCloudControllerClient.DeleteRouteCallCount()).To(Equal(1)) Expect(fakeCloudControllerClient.DeleteRouteArgsForCall(0)).To(Equal("some-route-guid")) }) }) Context("when the API returns both warnings and an error", func() { var expectedErr error BeforeEach(func() { expectedErr = errors.New("bananahammock") fakeCloudControllerClient.DeleteRouteReturns(ccv2.Warnings{"foo", "bar"}, expectedErr) }) It("returns both the warnings and the error", func() { warnings, err := actor.DeleteRoute("some-route-guid") Expect(err).To(MatchError(expectedErr))