Example #1
0
								Ω(found).Should(BeTrue())
							})

							Describe("streaming to a destination", func() {
								var fakeDestination *fakes.FakeArtifactDestination

								BeforeEach(func() {
									fakeDestination = new(fakes.FakeArtifactDestination)
								})

								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))