mailServer.Close() }) Describe("NewClient", func() { It("defaults the ConnectTimeout to 15 seconds", func() { config.ConnectTimeout = 0 client = mail.NewClient(config) Expect(client.ConnectTimeout()).To(Equal(15 * time.Second)) }) }) Describe("Send", func() { It("should use the provided logger when logging", func() { config.LoggingEnabled = true client = mail.NewClient(config) err := client.Send(mail.Message{}, logger) Expect(err).NotTo(HaveOccurred()) lines, err := parseLogLines(buffer.Bytes()) Expect(err).NotTo(HaveOccurred()) Expect(lines).To(ContainElement(logLine{ Source: "notifications", Message: "notifications.smtp.hello-initiating", LogLevel: int(lager.INFO), Data: map[string]interface{}{ "session": "1", }, }))