testErr := errors.New("failure") BeforeEach(func() { containerizer.HandlesReturns([]string{}, testErr) }) It("should return an error", func() { _, err := gdnr.Containers(garden.Properties{}) Expect(err).To(MatchError(testErr)) }) }) Describe("destroying a container", func() { It("asks the containerizer to destroy the container", func() { Expect(gdnr.Destroy("some-handle")).To(Succeed()) Expect(containerizer.DestroyCallCount()).To(Equal(1)) _, handle := containerizer.DestroyArgsForCall(0) Expect(handle).To(Equal("some-handle")) }) It("asks the networker to destroy the container network", func() { gdnr.Destroy("some-handle") Expect(networker.DestroyCallCount()).To(Equal(1)) networkLogger, handleToDestroy := networker.DestroyArgsForCall(0) Expect(handleToDestroy).To(Equal("some-handle")) Expect(networkLogger).To(Equal(logger)) }) It("should destroy the key space of the property manager", func() { gdnr.Destroy("some-handle")