Sha256: cac5652ddf69688e841b59f0cc293a65f118cd928ba864de9587cb0b56922ed3
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' require 'sprockets' describe "sprockets integration" do before do @sprockets = Sprockets::Environment.new app_path = Pathname(__FILE__).join('../app') @sprockets.append_path app_path.join('assets/javascripts') @sprockets.append_path app_path.join('views') @sprockets.register_engine '.hbs', Handlebars::Tilt @context = Handlebars::TemplateHandler.handlebars source = <<-JS (function(Handlebars) { //BEGIN SPROCKETS OUTPUT #{@sprockets['templates.js'].source} //END SPROCKETS OUTPUT }) JS @context.runtime.eval(source).call(@context.handlebars) end it 'precompiles templates' do @context.handlebars.templates['foobars']['whole'].call('thing' => 'enchilada').should match 'whole enchilada' end it 'precompiles partials' do @context.compile('{{>foobars/partial}}').call(:thing => 'enchilada').should match 'partial enchilada' @context.handlebars.partials['foobars/partial'].call(:thing => 'enchilada').should match 'partial enchilada' end end def h(*args) ERB::Util.h args.join(', ') end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
handlebars-rails-0.3.2 | spec/precompile_spec.rb |
handlebars-rails-0.3.1 | spec/precompile_spec.rb |
handlebars-rails-0.3.0 | spec/precompile_spec.rb |