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

var _ = Describe("CheckTarget", func() {
	var (
		binaryName string
		fakeConfig *commandsfakes.FakeConfig
	)

	BeforeEach(func() {
		binaryName = "faceman"
		fakeConfig = new(commandsfakes.FakeConfig)
		fakeConfig.BinaryNameReturns(binaryName)
	})

	Context("when the api endpoint is not set", func() {
		It("returns an error", func() {
			err := CheckTarget(fakeConfig, false, false)
			Expect(err).To(MatchError(NoAPISetError{
				BinaryName: binaryName,
			}))
		})
	})

	Context("when the api endpoint is set", func() {
		BeforeEach(func() {
			fakeConfig.TargetReturns("some-url")
		})
Ejemplo n.º 2
0
	. "github.com/onsi/gomega/gbytes"
)

var _ = Describe("Help Command", func() {
	var (
		fakeUI     *ui.UI
		fakeActor  *v2fakes.FakeHelpActor
		cmd        HelpCommand
		fakeConfig *commandsfakes.FakeConfig
	)

	BeforeEach(func() {
		fakeUI = ui.NewTestUI(NewBuffer(), NewBuffer())
		fakeActor = new(v2fakes.FakeHelpActor)
		fakeConfig = new(commandsfakes.FakeConfig)
		fakeConfig.BinaryNameReturns("faceman")

		cmd = HelpCommand{
			UI:     fakeUI,
			Actor:  fakeActor,
			Config: fakeConfig,
		}
	})

	Context("providing help for a specific command", func() {
		Describe("built-in command", func() {
			BeforeEach(func() {
				cmd.OptionalArgs = flags.CommandName{
					CommandName: "help",
				}