Expect(d.RemoveImageCalled).To(BeFalse()) }) }) Context("because it cannot push the image", func() { var ( e = errors.New("error: cannot connect to remote registry") ) BeforeEach(func() { c = getDefaultConfiguration() d = docker.NewMock() d.PushHandler = func(option docker.PushOptions, stream docker.LogStream) error { return e } }) JustBeforeEach(func() { err = Publish(d, ls, c) }) It("should return a push error", func() { Expect(err).To(HaveOccurred()) Expect(err).To(Equal(e)) }) It("should try to push an image on the registry", func() { Expect(d.TagCalled).To(BeTrue()) Expect(d.PushCalled).To(BeTrue()) }) It("should try to remove the registry tag", func() {