Some checks failed
continuous-integration/drone/push Build is failing
See #689
42 lines
578 B
Go
42 lines
578 B
Go
package recipe
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsDirty(t *testing.T) {
|
|
r := Get("abra-test-recipe")
|
|
|
|
if err := r.EnsureExists(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
isDirty, err := r.IsDirty()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
assert.False(t, isDirty)
|
|
|
|
fpath := filepath.Join(r.Dir, "foo.txt")
|
|
f, err := os.Create(fpath)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer f.Close()
|
|
defer t.Cleanup(func() {
|
|
os.Remove(fpath)
|
|
})
|
|
|
|
dirty, err := r.IsDirty()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
assert.True(t, dirty)
|
|
}
|