It("returns the error", func() { _, err := client.Capacity() Ω(err).Should(Equal(disaster)) }) }) }) Describe("Create", func() { It("sends a create request and returns a container", func() { spec := warden.ContainerSpec{ RootFSPath: "/some/roofs", } fakeConnection.WhenCreating = func(spec warden.ContainerSpec) (string, error) { return "some-handle", nil } container, err := client.Create(spec) Ω(err).ShouldNot(HaveOccurred()) Ω(container).ShouldNot(BeNil()) Ω(fakeConnection.Created()).Should(ContainElement(spec)) Ω(container.Handle()).Should(Equal("some-handle")) }) Context("when there is a connection error", func() { disaster := errors.New("oh no!") BeforeEach(func() { fakeConnection.WhenCreating = func(spec warden.ContainerSpec) (string, error) {