Sha256: 9539030c4c968dc2dff665c27d837b0378bc929dd32e70f073e98fbd3394e6c9

Contents?: true

Size: 766 Bytes

Versions: 4

Compression:

Stored size: 766 Bytes

Contents

require 'test_helper'

module HandlebarsAssets
  class HamlbarsTest < Test::Unit::TestCase
    include SprocketsScope
    include CompilerSupport

    def compile_haml(source)
      (Haml::Engine.new(source, HandlebarsAssets::Config.haml_options).render).chomp
    end

    def teardown
      HandlebarsAssets::Config.reset!
      HandlebarsAssets::Handlebars.reset!
    end

    def test_render_haml
      root = '/myapp/app/assets/templates'
      file = 'test_render.hamlbars'
      scope = make_scope root, file
      source = "%p This is {{handlebars}}"

      template = HandlebarsAssets::HandlebarsTemplate.new(scope.pathname.to_s) { source }

      assert_equal hbs_compiled('test_render', compile_haml(source)), template.render(scope, {})
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
handlebars_assets-0.18 test/handlebars_assets/hamlbars_test.rb
handlebars_assets-0.17.2 test/handlebars_assets/hamlbars_test.rb
handlebars_assets-0.17.1 test/handlebars_assets/hamlbars_test.rb
handlebars_assets-0.17 test/handlebars_assets/hamlbars_test.rb