}) AfterEach(func() { redisRunner.Stop() }) JustBeforeEach(func() { disconnectErr = redisClient.Disconnect() }) It("does not return an error", func() { Expect(disconnectErr).ToNot(HaveOccurred()) }) It("closes the redis connection", func() { _, err := redisClient.RDBPath() Expect(err).To(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("closed network connection")) }) Context("when the client is not connected", func() { BeforeEach(func() { Expect(redisClient.Disconnect()).ToNot(HaveOccurred()) }) It("returns an error", func() { Expect(disconnectErr).To(HaveOccurred()) }) }) })