Skip to content
Permalink
Browse files

fix: tests

  • Loading branch information...
caarlos0 committed Dec 13, 2018
1 parent 14e93c6 commit 07d9855890ebfc25dfbbdb0554135c01761917d7
Showing with 1 addition and 32 deletions.
  1. +0 −31 internal/pipe/git/git_test.go
  2. +1 −1 internal/pipe/snapshot/snapshot_test.go
@@ -62,37 +62,6 @@ func TestNewRepository(t *testing.T) {
assert.Contains(t, Pipe{}.Run(ctx).Error(), `fatal: ambiguous argument 'HEAD'`)
}

func TestNoTagsSnapshot(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()
testlib.GitInit(t)
testlib.GitRemoteAdd(t, "git@github.com:foo/bar.git")
testlib.GitCommit(t, "first")
var ctx = context.New(config.Project{
Snapshot: config.Snapshot{
NameTemplate: "SNAPSHOT-{{.Commit}}",
},
})
ctx.Snapshot = true
testlib.AssertSkipped(t, Pipe{}.Run(ctx))
assert.Contains(t, ctx.Version, "SNAPSHOT-")
}

func TestNoTagsSnapshotInvalidTemplate(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()
testlib.GitInit(t)
testlib.GitRemoteAdd(t, "git@github.com:foo/bar.git")
testlib.GitCommit(t, "first")
var ctx = context.New(config.Project{
Snapshot: config.Snapshot{
NameTemplate: "{{",
},
})
ctx.Snapshot = true
assert.EqualError(t, Pipe{}.Run(ctx), `failed to generate snapshot name: template: tmpl:1: unexpected unclosed action in command`)
}

// TestNoTagsNoSnapshot covers the situation where a repository
// only contains simple commits and no tags. In this case you have
// to set the --snapshot flag otherwise an error is returned.
@@ -19,7 +19,7 @@ func TestDefault(t *testing.T) {
},
}
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, "SNAPSHOT-{{ .Commit }}", ctx.Config.Snapshot.NameTemplate)
assert.Equal(t, "SNAPSHOT-{{ .ShortCommit }}", ctx.Config.Snapshot.NameTemplate)
}

func TestDefaultSet(t *testing.T) {

0 comments on commit 07d9855

Please sign in to comment.
You can’t perform that action at this time.