diff options
Diffstat (limited to 'hugolib/config_test.go')
-rw-r--r-- | hugolib/config_test.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go index cbfc71a22..780e5c33d 100644 --- a/hugolib/config_test.go +++ b/hugolib/config_test.go @@ -16,28 +16,28 @@ package hugolib import ( "testing" - "github.com/spf13/hugo/helpers" - - "github.com/spf13/hugo/hugofs" - "github.com/spf13/viper" + "github.com/spf13/afero" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func TestLoadGlobalConfig(t *testing.T) { +func TestLoadConfig(t *testing.T) { + t.Parallel() + // Add a random config variable for testing. // side = page in Norwegian. configContent := ` PaginatePath = "side" ` - fs := hugofs.NewMem() - viper.SetFs(fs.Source) + mm := afero.NewMemMapFs() + + writeToFs(t, mm, "hugo.toml", configContent) - writeSource(t, fs, "hugo.toml", configContent) + cfg, err := LoadConfig(mm, "", "hugo.toml") + require.NoError(t, err) - require.NoError(t, LoadGlobalConfig("", "hugo.toml")) - assert.Equal(t, "side", helpers.Config().GetString("paginatePath")) + assert.Equal(t, "side", cfg.GetString("paginatePath")) // default - assert.Equal(t, "layouts", viper.GetString("layoutDir")) + assert.Equal(t, "layouts", cfg.GetString("layoutDir")) } |