all: Refactor to nonglobal file systems

Updates #2701
Fixes #2951
This commit is contained in:
Bjørn Erik Pedersen
2017-01-10 10:55:03 +01:00
parent 0ada405912
commit c71e1b106e
71 changed files with 2219 additions and 1731 deletions

View File

@@ -17,6 +17,8 @@ import (
"path/filepath"
"testing"
"github.com/spf13/hugo/deps"
"github.com/spf13/hugo/hugofs"
"github.com/spf13/viper"
)
@@ -28,19 +30,19 @@ func TestRSSOutput(t *testing.T) {
viper.Set("rssURI", rssURI)
viper.Set("title", "RSSTest")
for _, s := range weightedSources {
writeSource(t, filepath.Join("content", "sect", s.Name), string(s.Content))
fs := hugofs.NewMem()
for _, src := range weightedSources {
writeSource(t, fs, filepath.Join("content", "sect", src.Name), string(src.Content))
}
if err := buildAndRenderSite(NewSiteDefaultLang()); err != nil {
t.Fatalf("Failed to build site: %s", err)
}
buildSingleSite(t, deps.DepsCfg{Fs: fs}, BuildCfg{})
// Home RSS
assertFileContent(t, filepath.Join("public", rssURI), true, "<?xml", "rss version", "RSSTest")
assertFileContent(t, fs, filepath.Join("public", rssURI), true, "<?xml", "rss version", "RSSTest")
// Section RSS
assertFileContent(t, filepath.Join("public", "sect", rssURI), true, "<?xml", "rss version", "Sects on RSSTest")
assertFileContent(t, fs, filepath.Join("public", "sect", rssURI), true, "<?xml", "rss version", "Sects on RSSTest")
// Taxonomy RSS
assertFileContent(t, filepath.Join("public", "categories", "hugo", rssURI), true, "<?xml", "rss version", "Hugo on RSSTest")
assertFileContent(t, fs, filepath.Join("public", "categories", "hugo", rssURI), true, "<?xml", "rss version", "Hugo on RSSTest")
}