fakeCredFactory, ) }) Describe("Validation", func() { var connectErr error var opts *options.SSHOptions BeforeEach(func() { 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)) })