Describe("GetAllLeaves", func() { Context("when there are no cloned layers", func() { var ( leaves []layercake.ID err error ) JustBeforeEach(func() { cake.GetAllLeavesReturns([]layercake.ID{layercake.DockerImageID("1"), layercake.DockerImageID("2")}, nil) leaves, err = aufsCake.GetAllLeaves() Expect(err).NotTo(HaveOccurred()) }) It("should delegate to the cake", func() { Expect(cake.GetAllLeavesCallCount()).To(Equal(1)) }) It("should get all leaves", func() { Expect(leaves).To(HaveLen(2)) Expect(leaves[0]).To(Equal(layercake.DockerImageID("1"))) Expect(leaves[1]).To(Equal(layercake.DockerImageID("2"))) }) }) Context("when there is a cloned layer", func() { var ( parentDir string namespacedChildDir string )