     
     // MARK: - Helpers
     
-    private func setupBlogIndex() throws -> ([BlogPost], [BlogTag], [BlogUser]) {
+    private func setupBlogIndex() throws -> (Page<BlogPost>, [BlogTag], [BlogUser]) {
         let user1 = TestDataBuilder.anyUser()
         try user1.save()
         let user2 = TestDataBuilder.anyUser(name: "Han", username: "han")

        let tag = BlogTag(name: "tatooine")
        try tag.save()
        try BlogTag.addTag(tag.name, to: post1)
        return ([post1, post2], [tag], [user1, user2])
    }
    
    private func setupBlogPost() throws -> (BlogPost, BlogUser) {

        XCTAssertEqual(viewRenderer.capturedContext?["site_twitter_handle"]?.string, "brokenhandsio")
    }
    
    func testBlogIndexPageGivenCorrectParameters() throws {
        let (posts, tags, authors) = try setupBlogIndex()
        _ = try viewFactory.blogIndexView(uri: indexURI, paginatedPosts: posts, tags: tags, authors: authors, loggedInUser: nil, disqusName: nil, siteTwitterHandle: nil)

        XCTAssertEqual(viewRenderer.capturedContext?["uri"]?.string, indexURI.description)
        XCTAssertTrue((viewRenderer.capturedContext?["blog_index_page"]?.bool) ?? false)
        
        XCTAssertEqual(viewRenderer.capturedContext?["posts"]?["data"]?.array?.count, posts.total)
        XCTAssertEqual((viewRenderer.capturedContext?["posts"]?["data"]?.array?.first)?["title"]?.string, posts.data.first?.title)
        XCTAssertEqual(viewRenderer.capturedContext?["tags"]?.array?.count, tags.count)
        XCTAssertEqual((viewRenderer.capturedContext?["tags"]?.array?.first)?["name"]?.string, tags.first?.name)
        XCTAssertEqual(viewRenderer.capturedContext?["authors"]?.array?.count, authors.count)
        XCTAssertEqual((viewRenderer.capturedContext?["authors"]?.array?.first)?["name"]?.string, authors.first?.name)
        XCTAssertEqual(viewRenderer.leafPath, "blog/blog")
    }
    
    func testNoPostsPassedIntoBlogIndexIfNoneAvailable() throws {
        let (_, tags, authors) = try setupBlogIndex()
        let emptyBlogPosts = try BlogPost.makeQuery().filter("title", "A non existent title").paginate(for: indexRequest)
        _ = try viewFactory.blogIndexView(uri: indexURI, paginatedPosts: emptyBlogPosts, tags: tags, authors: authors, loggedInUser: nil, disqusName: nil, siteTwitterHandle: nil)
        XCTAssertNil(viewRenderer.capturedContext?["posts"])
    }
    
    func testNoAuthorsPassedIntoBlogIndexIfNoneCreated() throws {
        let (posts, _, authors) = try setupBlogIndex()
        _ = try viewFactory.blogIndexView(uri: indexURI, paginatedPosts: posts, tags: [], authors: authors, loggedInUser: nil, disqusName: nil, siteTwitterHandle: nil)
        XCTAssertNil(viewRenderer.capturedContext?["tags"])
    }
    
    func testNoTagsPassedIntoBlogIndexIfNoneCreted() throws {
        let (posts, tags, _) = try setupBlogIndex()
        _ = try viewFactory.blogIndexView(uri: indexURI, paginatedPosts: posts, tags: tags, authors: [], loggedInUser: nil, disqusName: nil, siteTwitterHandle: nil)
        XCTAssertNil(viewRenderer.capturedContext?["authors"])
    }
    
    func testUserPassedToBlogIndexIfUserPassedIn() throws {
        let (posts, tags, authors) = try setupBlogIndex()
        _ = try viewFactory.blogIndexView(uri: indexURI, paginatedPosts: posts, tags: tags, authors: authors, loggedInUser: authors[0], disqusName: nil, siteTwitterHandle: nil)
        XCTAssertEqual(viewRenderer.capturedContext?["user"]?["name"]?.string, authors.first?.name)
    }
    
    func testDisqusNamePassedToBlogIndexIfPassedIn() throws {
        let (posts, tags, authors) = try setupBlogIndex()
        _ = try viewFactory.blogIndexView(uri: indexURI, paginatedPosts: posts, tags: tags, authors: authors, loggedInUser: nil, disqusName: "brokenhands", siteTwitterHandle: nil)
        XCTAssertEqual(viewRenderer.capturedContext?["disqus_name"]?.string, "brokenhands")
    }
    
    func testTwitterHandlePassedToBlogIndexIfPassedIn() throws {
        let (posts, tags, authors) = try setupBlogIndex()
        _ = try viewFactory.blogIndexView(uri: indexURI, paginatedPosts: posts, tags: tags, authors: authors, loggedInUser: nil, disqusName: nil, siteTwitterHandle: "brokenhandsio")
        XCTAssertEqual(viewRenderer.capturedContext?["site_twitter_handle"]?.string, "brokenhandsio")
    }
    
    func testAuthorViewHasCorrectParametersSet() throws {
        let (author, posts) = try setupAuthorPage()
