Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated tests code, still failing. Tests pending

  • Loading branch information...
commit fc1bdf092ef46a1f251d5287cd4f4afbfc827c78 1 parent bc16f3d
@goyox86 goyox86 authored
Showing with 11 additions and 21 deletions.
  1. +8 −18 test/dust_assets/tilt_dust_test.rb
  2. +3 −3 test/test_helper.rb
View
26 test/dust_assets/tilt_dust_test.rb
@@ -8,24 +8,14 @@ def test_render
class << scope
def logical_path ; 'x11' ; end
end
- template = HandlebarsAssets::TiltHandlebars.new('/myapp/app/assets/templates/x11.jst.hbs') { "This is {{handlebars}}" }
- assert_equal <<END_EXPECTED, template.render(scope, {})
- (function() {
- this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
- this.HandlebarsTemplates["x11"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
- helpers = helpers || Handlebars.helpers;
- var buffer = "", stack1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
-
-
- buffer += "This is ";
- stack1 = helpers.handlebars || depth0.handlebars;
- if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
- else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "handlebars", { hash: {} }); }
- buffer += escapeExpression(stack1);
- return buffer;});
- return HandlebarsTemplates["x11"];
- }).call(this);
-END_EXPECTED
+ template = DustAssets::TiltDust.new('/myapp/app/assets/templates/x11.jst.dust') { "Hello {name}!" }
+ compiled_template = <<-TEMPLATE
+ (function(ctx, callback) {
+ dust.loadSource('(function(){dust.register("x11",body_0);function body_0(chk,ctx){return chk.write("Hello ").reference(ctx.get("name"),ctx,"h").write("!");}return body_0;})();');
+ dust.render('x11', ctx, callback);
+ })
+ TEMPLATE
+ assert_equal compiled_template, template.render(scope, {})
end
end
end
View
6 test/test_helper.rb
@@ -1,5 +1,5 @@
-require 'handlebars_assets'
-require 'handlebars_assets/tilt_handlebars'
-require 'handlebars_assets/handlebars'
+require 'dust_assets'
+require 'dust_assets/tilt_dust'
+require 'dust_assets/dust'
require 'test/unit'
Please sign in to comment.
Something went wrong with that request. Please try again.