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!")