コード例 #1
0
					},
					ccv2.Warnings{"foo-3"},
					nil,
				)

				fakeCloudControllerClient.DeleteServiceBindingReturns(
					ccv2.Warnings{"foo-4", "foo-5"},
					nil,
				)
			})

			It("deletes the service binding", func() {
				warnings, err := actor.UnbindServiceBySpace("some-app", "some-service-instance", "some-space-guid")
				Expect(err).NotTo(HaveOccurred())
				Expect(warnings).To(ConsistOf(Warnings{"foo-1", "foo-2", "foo-3", "foo-4", "foo-5"}))
				Expect(fakeCloudControllerClient.DeleteServiceBindingCallCount()).To(Equal(1))
				Expect(fakeCloudControllerClient.DeleteServiceBindingArgsForCall(0)).To(Equal("some-service-binding-guid"))
			})

			Context("when the cloud controller API returns and error", func() {
				var expectedError error
				BeforeEach(func() {
					expectedError = errors.New("I am a CC error")
					fakeCloudControllerClient.DeleteServiceBindingReturns(ccv2.Warnings{"foo-4"}, expectedError)
				})

				It("returns the error", func() {
					warnings, err := actor.UnbindServiceBySpace("some-app", "some-service-instance", "some-space-guid")
					Expect(err).To(MatchError(expectedError))
					Expect(warnings).To(ConsistOf(Warnings{"foo-1", "foo-2", "foo-3", "foo-4"}))
				})