fixing setup bug, adding test

pull/8/head
Stephen Searles 7 years ago
parent e1183ee316
commit e950515960
  1. 9
      doc_test.go
  2. 3
      setup.go

@ -58,4 +58,13 @@ func TestDoc(t *testing.T) {
if len(c) != 1 { if len(c) != 1 {
t.Fatalf("expected 1 page, but saw %d pages", len(c)) t.Fatalf("expected 1 page, but saw %d pages", len(c))
} }
w.CH.NewContent("TEST 2!!", "")
c, err = GetContent(w.BlogFolder, w.CH.HugoSites)
if err != nil {
t.Fatalf("couldn't get content from the test environment: %v", err)
}
if len(c) != 2 {
t.Fatalf("expected 2 pages, but saw %d pages", len(c))
}
} }

@ -16,8 +16,9 @@ import (
func (ch *CaddyHugo) SetupCaddy(c *caddy.Controller) error { func (ch *CaddyHugo) SetupCaddy(c *caddy.Controller) error {
ch.Site = httpserver.GetConfig(c) ch.Site = httpserver.GetConfig(c)
err := ch.Setup(ch.Site.Root)
ch.Site.AddMiddleware(ch.Middleware(c)) ch.Site.AddMiddleware(ch.Middleware(c))
return ch.Setup(ch.Dir) return err
} }
func (ch *CaddyHugo) Setup(dir string) error { func (ch *CaddyHugo) Setup(dir string) error {

Loading…
Cancel
Save