Context("when limiting the memory fails", func() { BeforeEach(func() { fakeContainer.LimitMemoryReturns(errors.New("oh no!")) }) It("fail", func() { err := container.LimitMemory(garden.MemoryLimits{123}) Ω(err).Should(HaveOccurred()) }) }) }) Describe("getting memory limits", func() { It("obtains the current limits", func() { effectiveLimits := garden.MemoryLimits{2048} fakeContainer.CurrentMemoryLimitsReturns(effectiveLimits, nil) limits, err := container.CurrentMemoryLimits() Ω(err).ShouldNot(HaveOccurred()) Ω(limits).ShouldNot(BeZero()) Ω(limits).Should(Equal(effectiveLimits)) }) It("does not change the memory limit", func() { _, err := container.CurrentMemoryLimits() Ω(err).ShouldNot(HaveOccurred()) Ω(fakeContainer.LimitMemoryCallCount()).Should(BeZero()) })