for t := range timeCh { times = append(times, t) } Expect(times[1]).To(BeTemporally("~", times[0].Add(115*time.Millisecond), 30*time.Millisecond)) Expect(times[2]).To(BeTemporally("~", times[1].Add(115*time.Millisecond), 30*time.Millisecond)) }) }) }) Context("when dialing the connect address fails", func() { var fakeTarget *fake_net.FakeConn BeforeEach(func() { fakeTarget = &fake_net.FakeConn{} fakeSecureClient.DialReturns(fakeTarget, errors.New("boom")) }) It("does not call close on the target connection", func() { Consistently(fakeTarget.CloseCallCount).Should(Equal(0)) }) }) }) Describe("Wait", func() { var opts *options.SSHOptions BeforeEach(func() { opts = &options.SSHOptions{ AppName: "app-1", }