}) }) }) Context("when docker have issue(s)", func() { Context("because we cannot run a container", func() { var ( e = errors.New("error: socket timeout") ) BeforeEach(func() { c = getDefaultConfiguration() d = docker.NewMock() d.RunHandler = func(option docker.RunOptions, stream docker.LogStream) (int, error) { return 0, e } }) It("should return an error", func() { Expect(err).To(HaveOccurred()) Expect(err).To(Equal(e)) }) It("should try to run a container", func() { Expect(d.RunCalled).To(BeTrue()) }) }) Context("because the container exit with an error", func() { var ( e = 255