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()
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") })