disaster := errors.New("nope") BeforeEach(func() { fakeProvider.WorkersReturns(nil, disaster) }) It("returns the error", func() { Expect(createErr).To(Equal(disaster)) }) }) }) Describe("LookupContainer", func() { Context("when looking up the container info contains an error", func() { BeforeEach(func() { fakeProvider.GetContainerReturns(db.Container{}, false, errors.New("disaster")) }) It("returns the error", func() { container, found, err := pool.LookupContainer(logger, "some-handle") Expect(err).To(HaveOccurred()) Expect(container).To(BeNil()) Expect(found).To(BeFalse()) }) }) Context("when looking up the container info does not find the container info", func() { BeforeEach(func() { fakeProvider.GetContainerReturns(db.Container{}, false, nil) })