It("removes the sandbox by name", func() { err := sandboxRepo.Destroy("some-sandbox-name") Expect(err).NotTo(HaveOccurred()) Expect(sandboxRepo.Sandboxes).NotTo(HaveKey("some-sandbox-name")) }) It("removes the sandbox namespace", func() { err := sandboxRepo.Destroy("some-sandbox-name") Expect(err).NotTo(HaveOccurred()) Expect(sbox.NamespaceCallCount()).To(Equal(1)) Expect(namespaceRepo.DestroyCallCount()).To(Equal(1)) ns := namespaceRepo.DestroyArgsForCall(0) Expect(ns).To(Equal(sboxNamespace)) }) It("does not remove other sandbox", func() { err := sandboxRepo.Destroy("some-sandbox-name") Expect(err).NotTo(HaveOccurred()) sb, err := sandboxRepo.Get("some-other-sandbox-name") Expect(err).NotTo(HaveOccurred()) Expect(sb).To(Equal(otherSbox)) }) Context("when the sandbox does not exist", func() { It("returns a NotFoundError", func() { err := sandboxRepo.Destroy("some-non-existent-name")