Skip to content

Commit

Permalink
Helpers defined later should override earlier ones.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsubrian committed Oct 5, 2012
1 parent c103466 commit 69edede
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/rendering.js
Expand Up @@ -100,8 +100,8 @@ describe('Rendering & Helpers', function() {
});

it('should respect String path-specific helpers', function(done) {
views.helper('/hey', {name: 'Donatello'});
views.helper({name: 'Leonardo'});
views.helper('/hey', {name: 'Donatello'});
server.on('request', function(req, res) {
views.render(req, res, 'hello');
});
Expand All @@ -120,8 +120,8 @@ describe('Rendering & Helpers', function() {
});

it('should respect RegExp path-specific helpers', function(done) {
views.helper(/^\/hello$/, {name: 'Donatello'});
views.helper({name: 'Leonardo'});
views.helper(/^\/hello$/, {name: 'Donatello'});
server.on('request', function(req, res) {
views.render(req, res, 'hello');
});
Expand Down
4 changes: 2 additions & 2 deletions views.js
Expand Up @@ -495,13 +495,13 @@ Views.prototype._processHelpers = function(req, res, conf, callback) {
if (typeof helper === 'function') {
helper.call(views, req, res, function(err, data) {
if (data) {
helpers.push(data);
helpers.unshift(data);
}
done(err);
});
}
else {
helpers.push(helper);
helpers.unshift(helper);
done(null);
}
});
Expand Down

0 comments on commit 69edede

Please sign in to comment.