It("return the error", func() { err := gdnr.Destroy("some-handle") Expect(err).To(MatchError("containerized deletion failed")) }) It("should not destroy the network configuration", func() { err := gdnr.Destroy("some-handle") Expect(err).To(HaveOccurred()) Expect(networker.DestroyCallCount()).To(Equal(0)) }) }) Context("when network deletion fails", func() { BeforeEach(func() { networker.DestroyReturns(errors.New("network deletion failed")) }) It("returns the error", func() { err := gdnr.Destroy("some-handle") Expect(err).To(MatchError("network deletion failed")) }) It("should not destroy the key space of the property manager", func() { err := gdnr.Destroy("some-handle") Expect(err).To(HaveOccurred()) Expect(propertyManager.DestroyKeySpaceCallCount()).To(Equal(0)) }) }) })