예제 #1
0
파일: ui_test.go 프로젝트: sebrandon1/cli
package ui_test

import (
	"code.cloudfoundry.org/cli/utils/configv3"
	. "code.cloudfoundry.org/cli/utils/ui"
	"code.cloudfoundry.org/cli/utils/ui/uifakes"

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

var _ = Describe("UI", func() {
	var (
		ui         *UI
		fakeConfig *uifakes.FakeConfig
		inBuffer   *Buffer
	)

	BeforeEach(func() {
		fakeConfig = new(uifakes.FakeConfig)
		fakeConfig.ColorEnabledReturns(configv3.ColorEnabled)

		var err error
		ui, err = NewUI(fakeConfig)
		Expect(err).NotTo(HaveOccurred())

		inBuffer = NewBuffer()
		ui.In = inBuffer
		ui.Out = NewBuffer()
		ui.Err = NewBuffer()
예제 #2
0
파일: i18n_test.go 프로젝트: fujitsu-cf/cli
package ui_test

import (
	. "code.cloudfoundry.org/cli/utils/ui"
	"code.cloudfoundry.org/cli/utils/ui/uifakes"

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

var _ = Describe("i18n", func() {
	var fakeConfig *uifakes.FakeConfig

	BeforeEach(func() {
		fakeConfig = new(uifakes.FakeConfig)
	})

	Context("when the config file is empty", func() {
		It("returns back default translation", func() {
			translationFunc, err := GetTranslationFunc(fakeConfig)
			Expect(err).ToNot(HaveOccurred())
			Expect(translationFunc("\nApp started\n")).To(Equal("\nApp started\n"))
		})
	})

	Context("when the config file is set", func() {
		Context("when we support the language", func() {
			BeforeEach(func() {
				fakeConfig.LocaleReturns("fr-FR")
			})