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:
parent
530f9fc84b
commit
2919edc13f
@ -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())
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user