Ω(err).Should(Equal(disaster)) }) }) }) Describe("CurrentCPULimits", func() { It("sends an empty limit request and returns its response", func() { limitsToReturn := warden.CPULimits{ LimitInShares: 1, } fakeConnection.WhenLimitingCPU = func(handle string, limits warden.CPULimits) (warden.CPULimits, error) { return limitsToReturn, nil } limits, err := container.CurrentCPULimits() Ω(err).ShouldNot(HaveOccurred()) Ω(limits).Should(Equal(limitsToReturn)) }) Context("when the request fails", func() { disaster := errors.New("oh no!") BeforeEach(func() { fakeConnection.WhenLimitingCPU = func(handle string, limits warden.CPULimits) (warden.CPULimits, error) { return warden.CPULimits{}, disaster } }) It("returns the error", func() {