示例#1
0
								})

								Context("when the resource can stream out", func() {
									var streamedOut io.ReadCloser

									BeforeEach(func() {
										streamedOut = gbytes.NewBuffer()
										fakeContainer.StreamOutReturns(streamedOut, nil)
									})

									It("streams the resource to the destination", func() {
										err := artifactSource.StreamTo(fakeDestination)
										Ω(err).ShouldNot(HaveOccurred())

										Ω(fakeContainer.StreamOutCallCount()).Should(Equal(1))
										spec := fakeContainer.StreamOutArgsForCall(0)
										Ω(spec.Path).Should(Equal("/tmp/build/a-random-guid/"))
										Ω(spec.User).Should(Equal("")) // use default

										Ω(fakeDestination.StreamInCallCount()).Should(Equal(1))
										dest, src := fakeDestination.StreamInArgsForCall(0)
										Ω(dest).Should(Equal("."))
										Ω(src).Should(Equal(streamedOut))
									})

									Context("when streaming out of the versioned source fails", func() {
										disaster := errors.New("nope")

										BeforeEach(func() {
											fakeContainer.StreamOutReturns(nil, disaster)
										})