Sha256: 3f97b3cd6c550e66ab60196ed3b1514b84094e985ee95d15295bf4cf27202e5c

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

require 'helper'

class TestSkimTemplate < TestSkim
  def test_registered_extension
    assert_equal Skim::Template, Tilt['test.skim']
  end

  def test_sprockets_integration_without_asset
    compiled = ExecJS.compile(asset_source('test.js'))
    assert_equal "<p>Hello World, meet Skim</p>", compiled.eval("JST.test({name: 'Skim'})")
  end

  def test_sprockets_integration_with_asset
    Skim::Engine.default_options[:use_asset] = true
    compiled = ExecJS.compile(skim_source + ";" + asset_source('test.js'))
    assert_equal "<p>Hello World, meet Skim</p>", compiled.eval("JST.test({name: 'Skim'})")
  ensure
    Skim::Engine.default_options[:use_asset] = false
  end

  def test_sprockets_require_directive
    compiled = ExecJS.compile(asset_source('application.js'))
    assert_equal "<p>Hello World, meet Skim</p>", compiled.eval("JST.test({name: 'Skim'})")
  end

  private
  def asset_source(asset_name)
    env = Sprockets::Environment.new
    env.append_path File.dirname(__FILE__)
    env[asset_name].to_s
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
skim-0.9.3 test/test_skim_template.rb
skim-0.9.2 test/test_skim_template.rb
skim-0.9.1 test/test_skim_template.rb
skim-0.9.0 test/test_skim_template.rb
skim-0.8.6 test/test_skim_template.rb
skim-0.8.5 test/test_skim_template.rb