Exemplo n.º 1
0
				Expect(fakeUI.Out).To(Say("No api endpoint set. Use 'cf api' to set an endpoint"))
			})
		})

		Context("when the API is set", func() {
			BeforeEach(func() {
				fakeConfig.TargetReturns("some-api-target")
				fakeConfig.APIVersionReturns("some-version")
				fakeConfig.TargetedOrganizationReturns(configv3.Organization{
					Name: "some-org",
				})
				fakeConfig.TargetedSpaceReturns(configv3.Space{
					Name: "some-space",
				})
				fakeConfig.CurrentUserReturns(configv3.User{
					Name: "admin",
				}, nil)
			})

			It("outputs the standard target information", func() {
				Expect(err).ToNot(HaveOccurred())
				Expect(fakeUI.Out).To(Say("API endpoint:\\s+some-api-target"))
				Expect(fakeUI.Out).To(Say("API version:\\s+some-version"))
				Expect(fakeUI.Out).To(Say("User:\\s+admin"))
				Expect(fakeUI.Out).To(Say("Org:\\s+some-org"))
				Expect(fakeUI.Out).To(Say("Space:\\s+some-space"))
			})
		})

		Context("when passed a --unset", func() {
			BeforeEach(func() {
Exemplo n.º 2
0
			})
			fakeConfig.TargetedSpaceReturns(configv3.Space{
				GUID: "some-space-guid",
				Name: "some-space",
			})

			cmd.RequiredArgs.AppName = "some-app"
			cmd.RequiredArgs.ServiceInstanceName = "some-service"
		})

		Context("when getting the logged in user results in an error", func() {
			var expectedErr error

			BeforeEach(func() {
				expectedErr = errors.New("got bananapants??")
				fakeConfig.CurrentUserReturns(configv3.User{}, expectedErr)
			})

			It("returns the same error", func() {
				Expect(executeErr).To(MatchError(expectedErr))
			})
		})

		Context("when getting the logged in user does not result in an error", func() {
			BeforeEach(func() {
				fakeConfig.CurrentUserReturns(configv3.User{
					Name: "some-user",
				}, nil)
			})

			It("displays flavor text", func() {