mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-13 13:48:40 +02:00
test: cover default method
This commit is contained in:
parent
17f09de1e8
commit
87926dacbd
@ -28,6 +28,9 @@ func (Pipe) String() string {
|
||||
func (Pipe) Default(ctx *context.Context) error {
|
||||
for i := range ctx.Config.S3 {
|
||||
s3 := &ctx.Config.S3[i]
|
||||
if s3.Bucket == "" {
|
||||
continue
|
||||
}
|
||||
if s3.Folder == "" {
|
||||
s3.Folder = "{{ .ProjectName }}/{{ .Tag }}"
|
||||
}
|
||||
|
@ -15,3 +15,31 @@ func TestDescription(t *testing.T) {
|
||||
func TestNoS3(t *testing.T) {
|
||||
assert.NoError(t, Pipe{}.Run(context.New(config.Project{})))
|
||||
}
|
||||
|
||||
func TestDefaultsNoS3(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
var ctx = context.New(config.Project{
|
||||
S3: []config.S3{
|
||||
config.S3{},
|
||||
},
|
||||
})
|
||||
assert.NoError(Pipe{}.Default(ctx))
|
||||
assert.Equal([]config.S3{config.S3{}}, ctx.Config.S3)
|
||||
}
|
||||
|
||||
func TestDefaults(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
var ctx = context.New(config.Project{
|
||||
S3: []config.S3{
|
||||
{
|
||||
Bucket: "foo",
|
||||
},
|
||||
},
|
||||
})
|
||||
assert.NoError(Pipe{}.Default(ctx))
|
||||
assert.Equal([]config.S3{config.S3{
|
||||
Bucket: "foo",
|
||||
Region: "us-east-1",
|
||||
Folder: "{{ .ProjectName }}/{{ .Tag }}",
|
||||
}}, ctx.Config.S3)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user