示例#1
0
				})
			})
		})

		Context("when the app model and endpoint info are successfully acquired", func() {
			BeforeEach(func() {
				fakeAppFactory.GetReturns(app.App{
					State: "STARTED",
					Diego: true,
				}, nil)
				fakeInfoFactory.GetReturns(info.Info{}, nil)
				fakeCredFactory.GetReturns(credential.Credential{}, nil)
			})

			It("gets the current oauth token credential", func() {
				Expect(fakeCredFactory.GetCallCount()).To(Equal(1))
			})

			Context("when getting the credential fails", func() {
				BeforeEach(func() {
					fakeCredFactory.GetReturns(credential.Credential{}, errors.New("woops"))
				})

				It("returns the error", func() {
					Expect(fakeCredFactory.GetCallCount()).To(Equal(1))
					Expect(connectErr).To(Equal(errors.New("woops")))
				})
			})

			Context("when the app is not in the 'STARTED' state", func() {
				BeforeEach(func() {