Permalink
Browse files

handle null template paths on asset bundler

  • Loading branch information...
1 parent e902dd6 commit 1e2ffb650aefa3d37d07cffeb561becaf65640da @laktek committed Mar 17, 2013
Showing with 11 additions and 0 deletions.
  1. +4 −0 lib/asset_bundler.js
  2. +7 −0 spec/asset_bundler.spec.js
View
4 lib/asset_bundler.js
@@ -46,6 +46,10 @@ module.exports = {
compileAndMinify: function(template_path, template_extension, compiler, minifier, callback) {
var self = this;
+ if(!template_path) {
+ return callback("Template path can't be null", null);
+ }
+
if (!minifier) {
return callback("No minifier found", null);
}
View
7 spec/asset_bundler.spec.js
@@ -363,6 +363,13 @@ describe("prepare a bundle", function() {
describe("compile and minify", function() {
+ it("call the callback with an error if template path is null", function() {
+ var spyCallback = jasmine.createSpy();
+ asset_bundler.compileAndMinify(null, ".js", {}, null, spyCallback);
+
+ expect(spyCallback).toHaveBeenCalledWith("Template path can't be null", null);
+ });
+
it("call the callback with an error if no minifier found", function() {
var spyCallback = jasmine.createSpy();
asset_bundler.compileAndMinify("path/test.js", ".js", {}, null, spyCallback);

0 comments on commit 1e2ffb6

Please sign in to comment.