示例#1
0
文件: ui_test.go 项目: fujitsu-cf/cli
		})
	})

	Describe("NotifyUpdateIfNeeded", func() {
		var (
			output []string
			config coreconfig.ReadWriter
		)

		BeforeEach(func() {
			config = testconfig.NewRepository()
		})

		It("Prints a notification to user if current version < min cli version", func() {
			config.SetMinCLIVersion("6.0.0")
			config.SetMinRecommendedCLIVersion("6.5.0")
			config.SetAPIVersion("2.15.1")
			cf.Version = "5.0.0"
			output = io_helpers.CaptureOutput(func() {
				ui := NewUI(os.Stdin, os.Stdout, NewTeePrinter(os.Stdout), fakeLogger)
				ui.NotifyUpdateIfNeeded(config)
			})

			Expect(output).To(ContainSubstrings([]string{"Cloud Foundry API version",
				"requires CLI version 6.0.0",
				"You are currently on version 5.0.0",
				"To upgrade your CLI, please visit: https://github.com/cloudfoundry/cli#downloads",
			}))
		})

		It("Doesn't print a notification to user if current version >= min cli version", func() {