summaryrefslogtreecommitdiffstats
path: root/hugolib/menu_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-01-10 10:55:03 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-04 11:37:25 +0700
commitc71e1b106e6011d148cac899f83c4685dee33a22 (patch)
treec5c7090f0c2398c7771e4908ebcc97aa7714ffd2 /hugolib/menu_test.go
parent0ada40591216572b0e4c6a8ab986b0aa4fb13c13 (diff)
all: Refactor to nonglobal file systems
Updates #2701 Fixes #2951
Diffstat (limited to 'hugolib/menu_test.go')
-rw-r--r--hugolib/menu_test.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/hugolib/menu_test.go b/hugolib/menu_test.go
index 43a7623c7..8fd94ec48 100644
--- a/hugolib/menu_test.go
+++ b/hugolib/menu_test.go
@@ -18,12 +18,14 @@ import (
"strings"
"testing"
+ "github.com/spf13/hugo/deps"
+
"github.com/spf13/hugo/helpers"
+ "github.com/spf13/hugo/hugofs"
"path/filepath"
toml "github.com/pelletier/go-toml"
- "github.com/spf13/hugo/hugofs"
"github.com/spf13/hugo/source"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
@@ -677,31 +679,29 @@ func setupTestMenuState(t *testing.T) {
}
func setupMenuTests(t *testing.T, pageSources []source.ByteSource) *Site {
- s := createTestSite(pageSources)
setupTestMenuState(t)
- testSiteSetup(s, t)
- return s
+ fs := hugofs.NewMem()
+
+ for _, src := range pageSources {
+ writeSource(t, fs, filepath.Join("content", src.Name), string(src.Content))
+
+ }
+
+ return buildSingleSite(t, deps.DepsCfg{Fs: fs}, BuildCfg{})
+
}
func createTestSite(pageSources []source.ByteSource) *Site {
- hugofs.InitMemFs()
return &Site{
- deps: newDeps(DepsCfg{}),
Source: &source.InMemorySource{ByteSource: pageSources},
Language: helpers.NewDefaultLanguage(),
}
}
-func testSiteSetup(s *Site, t *testing.T) {
- if err := buildSiteSkipRender(s); err != nil {
- t.Fatalf("Sites build failed: %s", err)
- }
-}
-
func tomlToMap(s string) (map[string]interface{}, error) {
tree, err := toml.Load(s)