var fakeConnection *fakes.FakeConnection BeforeEach(func() { fakeConnection = new(fakes.FakeConnection) }) JustBeforeEach(func() { client = New(fakeConnection) }) Describe("Capacity", func() { BeforeEach(func() { fakeConnection.CapacityReturns( garden.Capacity{ MemoryInBytes: 1111, DiskInBytes: 2222, MaxContainers: 42, }, nil, ) }) It("sends a capacity request and returns the capacity", func() { capacity, err := client.Capacity() Ω(err).ShouldNot(HaveOccurred()) Ω(capacity.MemoryInBytes).Should(Equal(uint64(1111))) Ω(capacity.DiskInBytes).Should(Equal(uint64(2222))) }) Context("when getting capacity fails", func() { disaster := errors.New("oh no!")
} Describe("Capacity", func() { capacity := garden.Capacity{ MemoryInBytes: 34567809, DiskInBytes: 7834506, } var gotCapacity garden.Capacity itRetries(func() error { var err error gotCapacity, err = conn.Capacity() return err }, func(err error) { innerConnection.CapacityReturns(capacity, err) }, func() int { return innerConnection.CapacityCallCount() }, func() { It("calls through to garden", func() { Ω(innerConnection.CapacityCallCount()).Should(Equal(1)) }) It("returns the capacity", func() { Ω(gotCapacity).Should(Equal(capacity)) }) }) }) Describe("List", func() { properties := garden.Properties{