Permalink
Browse files

Fixes #213 - made sure bug is covered by tests.

  • Loading branch information...
jonbullock committed Jun 22, 2016
1 parent 41e273e commit 07dd1577ae7fb72633d54e964f43576ac74f74ea
@@ -53,12 +53,13 @@ public void cleanup() throws InterruptedException {
db.drop();
db.close();
}
@Test
public void crawl() throws ConfigurationException {
Crawler crawler = new Crawler(db, sourceFolder, config);
crawler.crawl(new File(sourceFolder.getPath() + File.separator + config.getString(Keys.CONTENT_FOLDER)));
Assert.assertEquals(2, crawler.getDocumentCount("post"));
Assert.assertEquals(3, crawler.getDocumentCount("post"));
Assert.assertEquals(3, crawler.getDocumentCount("page"));
List<ODocument> results = db.getPublishedPosts();
@@ -70,6 +71,9 @@ public void crawl() throws ConfigurationException {
.containsValue("../../");
}
// covers bug #213
List<ODocument> publishedPostsByTag = db.getPublishedPostsByTag("blog");
Assert.assertEquals(2, publishedPostsByTag.size());
}
@Test
public void renderWithPrettyUrls() throws Exception {
@@ -86,7 +90,7 @@ public void renderWithPrettyUrls() throws Exception {
Crawler crawler = new Crawler(db, content, config);
crawler.crawl(new File(content.getPath() + File.separator + "content"));
Assert.assertEquals(2, crawler.getDocumentCount("post"));
Assert.assertEquals(3, crawler.getDocumentCount("post"));
Assert.assertEquals(3, crawler.getDocumentCount("page"));
DocumentIterator documents = new DocumentIterator(db.getPublishedPosts().iterator());
while (documents.hasNext()) {
@@ -0,0 +1,16 @@
title=Draft Post
date=2016-06-22
type=post
tags=blog
status=draft
og={"description": "Something"}
~~~~~~
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vel diam purus. Curabitur ut nisi lacus.
Nam id nisl quam. Donec a lorem sit amet libero pretium vulputate vel ut purus. Suspendisse leo arcu,
mattis et imperdiet luctus, pulvinar vitae mi. Quisque fermentum sollicitudin feugiat. Mauris nec leo
ligula. Vestibulum tristique odio ut risus ultricies a hendrerit quam iaculis. Duis tempor elit sit amet
ligula vehicula et iaculis sem placerat. Fusce dictum, metus at volutpat lacinia, elit massa auctor risus,
id auctor arcu enim eu augue. Donec ultrices turpis in mi imperdiet ac venenatis sapien sodales. In
consequat imperdiet nunc quis bibendum. Nulla semper, erat quis ornare tristique, lectus massa posuere
libero, ut vehicula lectus nunc ut lorem. Aliquam erat volutpat.
@@ -5,7 +5,7 @@
<div class="page-header">
<h1>Blog</h1>
</div>
<#list posts as post>
<#list published_posts as post>
<#if (post.status == "published")>
<a href="${post.uri}"><h1><#escape x as x?xml>${post.title}</#escape></h1></a>
<p>${post.date?string("dd MMMM yyyy")}</p>
@@ -3,7 +3,7 @@ layout 'layout/main.tpl',
div(class:"row-fluid marketing"){
div(class:"span12"){
posts[0..<2].each { post ->
published_posts[0..<2].each { post ->
h4 { a(href:"${post.uri}","${post.title}") }
p("${post.date.format("dd MMMM yyyy")} - ${post.body.substring(0, 150)}...")
}
@@ -10,7 +10,7 @@
<div class="row-fluid marketing">
<div class="span12">
<%posts[0..<2].each { post ->%>
<%published_posts[0..<2].each { post ->%>
<h4><a href="${post.uri}">${post.title}</a></h4>
<p>${post.date.format("dd MMMM yyyy")} - ${post.body.substring(0, 150)}...</p>
<%}%>

0 comments on commit 07dd157

Please sign in to comment.