stopChan <- struct{}{} go func() { ticker <- time.Time{} }() Consistently(mockSession.SendRequestCallCount).Should(Equal(2)) name, reply, payload := mockSession.SendRequestArgsForCall(0) Expect(name).To(Equal("*****@*****.**")) Expect(reply).To(BeTrue()) Expect(payload).To(BeNil()) }) }) Describe("#Resize", func() { It("should send a window-change request", func() { Expect(session.Resize(100, 200)).To(Succeed()) Expect(mockSession.SendRequestCallCount()).To(Equal(1)) name, reply, payload := mockSession.SendRequestArgsForCall(0) Expect(name).To(Equal("window-change")) Expect(reply).To(BeFalse()) Expect(payload).To(Equal([]byte{0, 0, 0, 100, 0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 0, 0})) }) Context("when sending the request fails", func() { It("should return an error", func() { mockSession.SendRequestReturns(false, errors.New("some error")) err := session.Resize(100, 200) Expect(err).To(MatchError("some error")) }) }) }) })