Describe("Close", func() { var opts *options.SSHOptions BeforeEach(func() { opts = &options.SSHOptions{ AppName: "app-1", } fakeAppFactory.GetReturns(app.App{ State: "STARTED", Diego: true, }, nil) fakeInfoFactory.GetReturns(info.Info{}, nil) fakeCredFactory.GetReturns(credential.Credential{}, nil) }) JustBeforeEach(func() { connectErr := secureShell.Connect(opts) Expect(connectErr).NotTo(HaveOccurred()) }) It("calls close on the secureClient", func() { err := secureShell.Close() Expect(err).NotTo(HaveOccurred()) Expect(fakeSecureClient.CloseCallCount()).To(Equal(1)) }) }) })