summaryrefslogtreecommitdiffstats
path: root/test/templating.js
blob: af29d25fe8157573890c8f707c6c00ecaf200b99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var pkg = require("../package.json");

describe('Templating', function () {
    var book;

    before(function() {
        return books.parse("basic")
            .then(function(_book) {
                book = _book;
            });
    });

    var testTpl = function(str, args, options) {
        return book.template.renderString(str, args, options)
        .then(book.template.postProcess)
    };

    describe('Context', function() {
        it('should correctly have access to generator', function() {
            return testTpl('{{ gitbook.generator }}')
                .then(function(content) {
                    content.should.equal("website");
                });
        });

        it('should correctly have access to gitbook version', function() {
            return testTpl('{{ gitbook.version }}')
                .then(function(content) {
                    content.should.equal(pkg.version.toString());
                });
        });
    });
});