opts = &options.SSHOptions{ AppName: "app-1", } }) JustBeforeEach(func() { connectErr = secureShell.Connect(opts) }) Context("when there is an error getting the app model", func() { BeforeEach(func() { fakeAppFactory.GetReturns(app.App{}, errors.New("woops")) }) It("returns the error", func() { Expect(fakeAppFactory.GetCallCount()).To(Equal(1)) Expect(connectErr).To(Equal(errors.New("woops"))) }) It("does not attempt to acquire endpoint info", func() { Expect(fakeInfoFactory.GetCallCount()).To(Equal(0)) }) }) Context("when the app model is successfully acquired", func() { BeforeEach(func() { fakeAppFactory.GetReturns(app.App{}, nil) fakeInfoFactory.GetReturns(info.Info{}, nil) }) It("gets the ssh endpoint information", func() {