1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00

added more tests to defaults pipe

This commit is contained in:
Carlos Alexandro Becker 2017-04-22 10:21:23 -03:00
parent 530f9fc84b
commit 2919edc13f
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 18 additions and 1 deletions

View File

@ -25,7 +25,6 @@ func (Pipe) Run(ctx *context.Context) error {
if ctx.Config.Release.GitHub.Name == "" {
repo, err := remoteRepo()
ctx.Config.Release.GitHub = repo
// TODO add a test to cover this
if err != nil {
return errors.New("failed reading repo from git: " + err.Error())
}

View File

@ -1,6 +1,8 @@
package defaults
import (
"io/ioutil"
"os"
"testing"
"github.com/goreleaser/goreleaser/config"
@ -75,3 +77,19 @@ func TestAcceptFiles(t *testing.T) {
})
}
}
func TestNotAGitRepo(t *testing.T) {
var assert = assert.New(t)
folder, err := ioutil.TempDir("", "goreleasertest")
assert.NoError(err)
previous, err := os.Getwd()
assert.NoError(err)
assert.NoError(os.Chdir(folder))
defer func() {
assert.NoError(os.Chdir(previous))
}()
var ctx = &context.Context{
Config: config.Project{},
}
assert.Error(Pipe{}.Run(ctx))
}