Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Fixing Attachment Error New Fork #14

Closed
wants to merge 15 commits into from
Prev Previous commit
Next Next commit
Updated Tests To Actually Create File
Gamma169 committed Aug 30, 2017
commit c331832adaea1ed9543417b573ed99c83211fde0
5 changes: 5 additions & 0 deletions message_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gomail

import (
"os"
"bytes"
"encoding/base64"
"io"
@@ -297,6 +298,9 @@ func TestRename(t *testing.T) {
m.SetBody("text/plain", "Test")
name, copy := mockCopyFile("/tmp/test.pdf")
rename := Rename("another.pdf")
os.Create("another.pdf")


m.Attach(name, copy, rename)

want := &message{
@@ -705,6 +709,7 @@ func getBoundaries(t *testing.T, count int, m string) []string {
var boundaryRegExp = regexp.MustCompile("boundary=(\\w+)")

func mockCopyFile(name string) (string, FileSetting) {
os.Create(filepath.Base(name))
return name, SetCopyFunc(func(w io.Writer) error {
_, err := w.Write([]byte("Content of " + filepath.Base(name)))
return err