Expect(locker.UnlockCallCount()).To(Equal(1)) }) It("logs entry and exit", func() { err := sandboxRepo.Destroy("some-sandbox-name") Expect(err).NotTo(HaveOccurred()) Expect(logger).To(gbytes.Say("destroy.starting.*some-sandbox-name")) Expect(logger).To(gbytes.Say("destroy.complete.*some-sandbox-name")) }) It("tears down the sandbox", func() { err := sandboxRepo.Destroy("some-sandbox-name") Expect(err).NotTo(HaveOccurred()) Expect(sbox.TeardownCallCount()).To(Equal(1)) }) 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))