"errors"
	"net/url"

	"code.cloudfoundry.org/garden-shed/layercake"
	"code.cloudfoundry.org/garden-shed/repository_fetcher"
	fakes "code.cloudfoundry.org/garden-shed/repository_fetcher/repository_fetcherfakes"
	"code.cloudfoundry.org/lager/lagertest"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Retryable", func() {
	var (
		fakeRemoteFetcher *fakes.FakeRepositoryFetcher

		repoURL   *url.URL
		logger    *lagertest.TestLogger
		retryable repository_fetcher.Retryable
	)

	BeforeEach(func() {
		var err error
		fakeRemoteFetcher = new(fakes.FakeRepositoryFetcher)

		repoURL, err = url.Parse("http://fake-registry-1.docker.io/")
		Expect(err).NotTo(HaveOccurred())
		logger = lagertest.NewTestLogger("test")

		retryable = repository_fetcher.Retryable{
			RepositoryFetcher: fakeRemoteFetcher,
			Logger:            logger,
package repository_fetcher_test

import (
	"net/url"

	. "code.cloudfoundry.org/garden-shed/repository_fetcher"
	fakes "code.cloudfoundry.org/garden-shed/repository_fetcher/repository_fetcherfakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("CompositeFetcher", func() {
	var (
		fakeLocalFetcher  *fakes.FakeRepositoryFetcher
		fakeRemoteFetcher *fakes.FakeRepositoryFetcher
		factory           *CompositeFetcher
	)

	BeforeEach(func() {
		fakeLocalFetcher = new(fakes.FakeRepositoryFetcher)
		fakeRemoteFetcher = new(fakes.FakeRepositoryFetcher)

		factory = &CompositeFetcher{
			LocalFetcher:  fakeLocalFetcher,
			RemoteFetcher: fakeRemoteFetcher,
		}
	})

	Context("when the URL does not contain a scheme", func() {
		It("delegates .Fetch to the local fetcher", func() {