1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/cmd/config_test.go
Carlos Alexandro Becker 9bd0033c09
feat: refactor main.go to spf13/cobra (#1472)
* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: revert

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* feat: refactor cli

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: lint

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: move

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-04-27 21:42:44 -03:00

42 lines
899 B
Go

package cmd
import (
"os"
"path/filepath"
"testing"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/stretchr/testify/require"
)
func TestConfigFlagNotSetButExists(t *testing.T) {
for _, name := range []string{
".goreleaser.yml",
".goreleaser.yaml",
"goreleaser.yml",
"goreleaser.yaml",
} {
t.Run(name, func(t *testing.T) {
folder, back := setup(t)
defer back()
require.NoError(t, os.Rename(
filepath.Join(folder, "goreleaser.yml"),
filepath.Join(folder, name),
))
proj, err := loadConfig("")
require.NoError(t, err)
require.NotEqual(t, config.Project{}, proj)
})
}
}
func TestConfigFileDoesntExist(t *testing.T) {
folder, back := setup(t)
defer back()
err := os.Remove(filepath.Join(folder, "goreleaser.yml"))
require.NoError(t, err)
proj, err := loadConfig("")
require.NoError(t, err)
require.Equal(t, config.Project{}, proj)
}