Permalink
Browse files

changed default for cache to true, updated docs and specs

  • Loading branch information...
1 parent 6ff2f03 commit 48e7affa7fc22601d1fc711f3c6bfc14d377e08e @interlock committed Mar 21, 2012
Showing with 12 additions and 7 deletions.
  1. +1 −0 README.md
  2. +2 −2 lib/lib.js
  3. +4 −1 package.json
  4. +5 −4 specs/cache.spec.js
View
1 README.md
@@ -30,6 +30,7 @@ The middleware builder takes two arguments `source` and `options`
* `exts_re`: RegExp instance for matching file extensions you want to match. Overrides `exts`
* `recursive`: bool indicating if sub directories are searched (default: true)
* `encoding`: String indicating the encoding to use (default: utf8)
+ * `cache`: boolean indicating if you want to use caching (default: true)
# Testing
View
4 lib/lib.js
@@ -6,7 +6,7 @@ var lib = {
exts: ['handlebars'],
recursive: true,
encoding: 'utf8',
- cache: false,
+ cache: true,
knownHelpers: [] // TODO implement this
},
generateTemplateRegExp: function(exts) {
@@ -69,4 +69,4 @@ var lib = {
}
};
-module.exports = lib;
+module.exports = lib;
View
5 package.json
@@ -1,8 +1,11 @@
{
"author": "James Sapara <jsapara@slicedprojects.ca>",
+ "contributors": [
+ ],
"name": "connect-handlebars",
"description": "Connect middleware for Handlebars",
- "version": "0.0.4",
+ "version": "0.0.5",
+ "private": true,
"repository": {
"type": "git",
"url": "git://github.com/interlock/connect-handlebars.git"
View
9 specs/cache.spec.js
@@ -6,7 +6,7 @@ describe('cache',function() {
var file_template = templates_dir + '/other.hbs';
var options;
beforeEach(function() {
- options = {cache: true, timestamps: {}, exts: ['hbs','handlebars'] };
+ options = {timestamps: {}, exts: ['hbs','handlebars'] };
});
it('stores the timestamp for templates', function() {
@@ -45,12 +45,13 @@ describe('cache',function() {
expect(options.timestamps['other.hbs']._template).not.toBe('foo');
});
- it('has caching off by default', function() {
+ it('can turn caching off', function() {
delete(options.cache);
var output = [];
+ options.cache = false;
options.timestamps['other.hbs'] = { ts: new Date(1999,1,1), _template: 'foo' };
lib._processFile(options, file_template, file_template, templates_dir, lib, output, { mtime: new Date(1999,1,1) } );
- expect(options.timestamps['other.hbs']._template).not.toBe('foo');
+ expect(options.timestamps['other.hbs']._template).toBe('foo');
});
-});
+});

0 comments on commit 48e7aff

Please sign in to comment.