summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-03-24 17:34:47 +0100
committerSamy Pessé <samypesse@gmail.com>2015-03-24 17:34:47 +0100
commitb2e684af8f132a617b808bb6f4b91af04425b63e (patch)
tree7cae8b369bc5db1efd08ae96c1c5da8edc65d6d3
parentb38a2c11a40c8e827a0e05d482d25e279c3ea6e5 (diff)
downloadgitbook-b2e684af8f132a617b808bb6f4b91af04425b63e.zip
gitbook-b2e684af8f132a617b808bb6f4b91af04425b63e.tar.gz
gitbook-b2e684af8f132a617b808bb6f4b91af04425b63e.tar.bz2
Add test for templating context
-rw-r--r--test/templating.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/templating.js b/test/templating.js
new file mode 100644
index 0000000..af29d25
--- /dev/null
+++ b/test/templating.js
@@ -0,0 +1,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());
+ });
+ });
+ });
+});