var ( context *fakes.Context linkFactory *fakes.LinkFactory sandboxRepository *fakes.SandboxRepository sbox *fakes.Sandbox moveLink commands.MoveLink ) BeforeEach(func() { context = &fakes.Context{} linkFactory = &fakes.LinkFactory{} context.LinkFactoryReturns(linkFactory) sandboxRepository = &fakes.SandboxRepository{} context.SandboxRepositoryReturns(sandboxRepository) sbox = &fakes.Sandbox{} sandboxRepository.GetReturns(sbox, nil) ns := &fakes.Namespace{} ns.FdReturns(999) ns.NameReturns("target-namespace") sbox.NamespaceReturns(ns) moveLink = commands.MoveLink{ Name: "link-name", SandboxName: "sandbox-name", } })
"github.com/cloudfoundry-incubator/ducati-daemon/sandbox" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("SandboxExists", func() { var ( repo *fakes.SandboxRepository sandboxExists conditions.SandboxExists context *fakes.Context ) BeforeEach(func() { repo = &fakes.SandboxRepository{} context = &fakes.Context{} context.SandboxRepositoryReturns(repo) sandboxExists = conditions.SandboxExists{ Name: "some-sandbox", } }) Context("when the namespace exists", func() { BeforeEach(func() { repo.GetReturns(&fakes.Sandbox{}, nil) }) It("returns true", func() { satisfied, err := sandboxExists.Satisfied(context) Expect(err).NotTo(HaveOccurred()) Expect(satisfied).To(BeTrue())