Example #1
0
	"github.com/cloudfoundry-incubator/ltc/exit_handler/fake_exit_handler"
	"github.com/cloudfoundry-incubator/ltc/receptor_client/fake_receptor_client_creator"
	"github.com/cloudfoundry-incubator/ltc/terminal"
	"github.com/cloudfoundry-incubator/ltc/test_helpers"
	"github.com/cloudfoundry-incubator/receptor/fake_receptor"
	"github.com/codegangsta/cli"
	"github.com/pivotal-golang/lager"
)

var _ = Describe("CliAppFactory", func() {

	var (
		fakeTargetVerifier           *fake_target_verifier.FakeTargetVerifier
		fakeReceptorClientCreator    *fake_receptor_client_creator.FakeCreator
		fakeExitHandler              *fake_exit_handler.FakeExitHandler
		outputBuffer                 *gbytes.Buffer
		terminalUI                   terminal.UI
		cliApp                       *cli.App
		cliConfig                    *config.Config
		latticeVersion, diegoVersion string
	)

	BeforeEach(func() {
		fakeTargetVerifier = &fake_target_verifier.FakeTargetVerifier{}
		fakeReceptorClientCreator = &fake_receptor_client_creator.FakeCreator{}
		fakeExitHandler = &fake_exit_handler.FakeExitHandler{}
		memPersister := persister.NewMemPersister()
		outputBuffer = gbytes.NewBuffer()
		terminalUI = terminal.NewUI(nil, outputBuffer, nil)
		cliConfig = config.New(memPersister)
		latticeVersion, diegoVersion = "v0.2.Test", "0.12345.0"
	"github.com/cloudfoundry-incubator/ltc/terminal/mocks"
	"github.com/cloudfoundry-incubator/ltc/test_helpers"
	"github.com/cloudfoundry-incubator/ltc/version/fake_version_manager"
	"github.com/codegangsta/cli"

	config_package "github.com/cloudfoundry-incubator/ltc/config"
)

var _ = Describe("CommandFactory", func() {
	var (
		stdinReader           *io.PipeReader
		stdinWriter           *io.PipeWriter
		outputBuffer          *gbytes.Buffer
		terminalUI            terminal.UI
		config                *config_package.Config
		configPersister       persister.Persister
		fakeTargetVerifier    *fake_target_verifier.FakeTargetVerifier
		fakeBlobStoreVerifier *fake_blob_store_verifier.FakeBlobStoreVerifier
		fakeExitHandler       *fake_exit_handler.FakeExitHandler
		fakePasswordReader    *mocks.FakePasswordReader
		fakeVersionManager    *fake_version_manager.FakeVersionManager
	)

	BeforeEach(func() {
		stdinReader, stdinWriter = io.Pipe()
		outputBuffer = gbytes.NewBuffer()
		fakeExitHandler = &fake_exit_handler.FakeExitHandler{}
		fakePasswordReader = &mocks.FakePasswordReader{}
		terminalUI = terminal.NewUI(stdinReader, outputBuffer, fakePasswordReader)
		fakeTargetVerifier = &fake_target_verifier.FakeTargetVerifier{}
		fakeBlobStoreVerifier = &fake_blob_store_verifier.FakeBlobStoreVerifier{}