}) Describe("streaming in", func() { It("streams the file in, waits for completion, and succeeds", func() { data := bytes.NewBufferString("chunk-1;chunk-2;chunk-3;") fakeContainer.StreamInStub = func(dest string, stream io.Reader) error { Ω(dest).Should(Equal("/dst/path")) Ω(ioutil.ReadAll(stream)).Should(Equal([]byte("chunk-1;chunk-2;chunk-3;"))) return nil } err := container.StreamIn("/dst/path", data) Ω(err).ShouldNot(HaveOccurred()) Ω(fakeContainer.StreamInCallCount()).Should(Equal(1)) }) itFailsWhenTheContainerIsNotFound(func() error { return container.StreamIn("/dst/path", nil) }) Context("when copying in to the container fails", func() { BeforeEach(func() { fakeContainer.StreamInReturns(errors.New("oh no!")) }) It("fails", func() { err := container.StreamIn("/dst/path", nil) Ω(err).Should(HaveOccurred()) })