summaryrefslogtreecommitdiffstats
path: root/hugolib/robotstxt_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/robotstxt_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/robotstxt_test.go')
-rw-r--r--hugolib/robotstxt_test.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/hugolib/robotstxt_test.go b/hugolib/robotstxt_test.go
index 1b42011ca..ace5162c8 100644
--- a/hugolib/robotstxt_test.go
+++ b/hugolib/robotstxt_test.go
@@ -17,10 +17,7 @@ import (
"path/filepath"
"testing"
- "github.com/spf13/hugo/hugofs"
-
"github.com/spf13/hugo/deps"
- "github.com/spf13/viper"
)
const robotTxtTemplate = `User-agent: Googlebot
@@ -30,18 +27,20 @@ const robotTxtTemplate = `User-agent: Googlebot
`
func TestRobotsTXTOutput(t *testing.T) {
- testCommonResetState()
-
- viper.Set("baseURL", "http://auth/bub/")
- viper.Set("enableRobotsTXT", true)
+ t.Parallel()
+ var (
+ cfg, fs = newTestCfg()
+ th = testHelper{cfg}
+ )
- fs := hugofs.NewMem()
+ cfg.Set("baseURL", "http://auth/bub/")
+ cfg.Set("enableRobotsTXT", true)
writeSource(t, fs, filepath.Join("layouts", "robots.txt"), robotTxtTemplate)
writeSourcesToSource(t, "content", fs, weightedSources...)
- buildSingleSite(t, deps.DepsCfg{Fs: fs}, BuildCfg{})
+ buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
- assertFileContent(t, fs, "public/robots.txt", true, "User-agent: Googlebot")
+ th.assertFileContent(t, fs, "public/robots.txt", true, "User-agent: Googlebot")
}