diff options
author | Bjørn Erik Pedersen <[email protected]> | 2016-08-05 11:04:52 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2016-09-06 18:32:17 +0300 |
commit | 36f2a1f676c6e8821d2d1600c696dcb2658d1cc9 (patch) | |
tree | 80e6215e63ce5fa3c8add46a74ef54da65ea277e /hugolib/hugo_sites_test.go | |
parent | b6fcb3d0bbf8e7632206104cb14ce9e708fdbcd3 (diff) | |
download | hugo-36f2a1f676c6e8821d2d1600c696dcb2658d1cc9.tar.gz hugo-36f2a1f676c6e8821d2d1600c696dcb2658d1cc9.zip |
Make the config loading testable
This is needed to verify #2309, but it closes a big hole in Hugo's automated tests.
The loading of the config is now moved to `hugolib` and the same default settings are now used
in production and tests.
As Viper now uses Afero as its filesystem, we now can write fairly complete integration tests with ease.
See #2309
Diffstat (limited to 'hugolib/hugo_sites_test.go')
-rw-r--r-- | hugolib/hugo_sites_test.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/hugolib/hugo_sites_test.go b/hugolib/hugo_sites_test.go index 185c241a5..8e5b6ae16 100644 --- a/hugolib/hugo_sites_test.go +++ b/hugolib/hugo_sites_test.go @@ -29,18 +29,8 @@ func init() { func testCommonResetState() { hugofs.InitMemFs() viper.Reset() - viper.Set("ContentDir", "content") - viper.Set("DataDir", "data") - viper.Set("I18nDir", "i18n") - viper.Set("themesDir", "themes") - viper.Set("LayoutDir", "layouts") - viper.Set("PublishDir", "public") - viper.Set("RSSUri", "rss") - - viper.Set("Taxonomies", map[string]interface{}{ - "tag": "tags", - "category": "categories", - }) + viper.SetFs(hugofs.Source()) + loadDefaultSettings() if err := hugofs.Source().Mkdir("content", 0755); err != nil { panic("Content folder creation failed.") |