diff options
author | spf13 <steve.francia@gmail.com> | 2014-11-04 00:41:47 -0500 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-11-04 00:41:47 -0500 |
commit | 4dcf734acd095654e5c0c64d7c8def8b51813deb (patch) | |
tree | cf9b4dc7889b93dc54eaecd03691dee4e808f85f /hugolib/rss_test.go | |
parent | 7b960ac121fa8cdbd9b52c4f2adf66d39440758e (diff) |
Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests.
Diffstat (limited to 'hugolib/rss_test.go')
-rw-r--r-- | hugolib/rss_test.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/hugolib/rss_test.go b/hugolib/rss_test.go index 8bcb155bd..11c29cb32 100644 --- a/hugolib/rss_test.go +++ b/hugolib/rss_test.go @@ -4,8 +4,10 @@ import ( "bytes" "testing" + "github.com/spf13/afero" + "github.com/spf13/hugo/helpers" + "github.com/spf13/hugo/hugofs" "github.com/spf13/hugo/source" - "github.com/spf13/hugo/target" "github.com/spf13/viper" ) @@ -31,11 +33,10 @@ const RSS_TEMPLATE = `<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom </rss>` func TestRSSOutput(t *testing.T) { - files := make(map[string][]byte) - target := &target.InMemoryTarget{Files: files} viper.Set("baseurl", "http://auth/bub/") + + hugofs.DestinationFS = new(afero.MemMapFs) s := &Site{ - Target: target, Source: &source.InMemorySource{ByteSource: WEIGHTED_SOURCES}, } s.initializeSiteInfo() @@ -55,12 +56,13 @@ func TestRSSOutput(t *testing.T) { t.Fatalf("Unable to RenderHomePage: %s", err) } - if _, ok := files[".xml"]; !ok { - t.Errorf("Unable to locate: %s", ".xml") - t.Logf("%q", files) + file, err := hugofs.DestinationFS.Open("rss.xml") + + if err != nil { + t.Fatalf("Unable to locate: %s", "rss.xml") } - rss, _ := files[".xml"] + rss := helpers.ReaderToBytes(file) if !bytes.HasPrefix(rss, []byte("<?xml")) { t.Errorf("rss feed should start with <?xml. %s", rss) } |