summaryrefslogtreecommitdiffstats
path: root/hugolib/rss_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-05 10:20:06 +0700
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-17 17:15:26 +0100
commit93ca7c9e958e34469a337e4efcc7c75774ec50fd (patch)
tree5dfa296cfe74fd5ef8f0d41ea4078704f453aa04 /hugolib/rss_test.go
parente34af6ee30f70f5780a281e2fd8f4ed9b487ee61 (diff)
all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables the use if `t.Parallel` in tests. Updates #2701 Fixes #3016
Diffstat (limited to 'hugolib/rss_test.go')
-rw-r--r--hugolib/rss_test.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/hugolib/rss_test.go b/hugolib/rss_test.go
index 74a59be6d..0a7f84a42 100644
--- a/hugolib/rss_test.go
+++ b/hugolib/rss_test.go
@@ -18,31 +18,32 @@ import (
"testing"
"github.com/spf13/hugo/deps"
- "github.com/spf13/hugo/hugofs"
- "github.com/spf13/viper"
)
func TestRSSOutput(t *testing.T) {
- testCommonResetState()
+ t.Parallel()
+ var (
+ cfg, fs = newTestCfg()
+ th = testHelper{cfg}
+ )
rssURI := "customrss.xml"
- viper.Set("baseURL", "http://auth/bub/")
- viper.Set("rssURI", rssURI)
- viper.Set("title", "RSSTest")
- fs := hugofs.NewMem()
+ cfg.Set("baseURL", "http://auth/bub/")
+ cfg.Set("rssURI", rssURI)
+ cfg.Set("title", "RSSTest")
for _, src := range weightedSources {
writeSource(t, fs, filepath.Join("content", "sect", src.Name), string(src.Content))
}
- buildSingleSite(t, deps.DepsCfg{Fs: fs}, BuildCfg{})
+ buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
// Home RSS
- assertFileContent(t, fs, filepath.Join("public", rssURI), true, "<?xml", "rss version", "RSSTest")
+ th.assertFileContent(t, fs, filepath.Join("public", rssURI), true, "<?xml", "rss version", "RSSTest")
// Section RSS
- assertFileContent(t, fs, filepath.Join("public", "sect", rssURI), true, "<?xml", "rss version", "Sects on RSSTest")
+ th.assertFileContent(t, fs, filepath.Join("public", "sect", rssURI), true, "<?xml", "rss version", "Sects on RSSTest")
// Taxonomy RSS
- assertFileContent(t, fs, filepath.Join("public", "categories", "hugo", rssURI), true, "<?xml", "rss version", "Hugo on RSSTest")
+ th.assertFileContent(t, fs, filepath.Join("public", "categories", "hugo", rssURI), true, "<?xml", "rss version", "Hugo on RSSTest")
}