Sha256: 072d4e3d900b257ec1613cb3b4a01e875bd0489bd259f71ddd5c7835e3b80f6e

Contents?: true

Size: 758 Bytes

Versions: 2

Compression:

Stored size: 758 Bytes

Contents

require 'contest'
require 'tilt'

begin
  require 'coffee_script'

  class CoffeeScriptTemplateTest < Test::Unit::TestCase
    test "is registered for '.coffee' files" do
      assert_equal Tilt::CoffeeScriptTemplate, Tilt['test.coffee']
    end

    test "compiles and evaluates the template on #render" do
      template = Tilt::CoffeeScriptTemplate.new { |t| "puts 'Hello, World!'\n" }
      assert_match "puts('Hello, World!');", template.render
    end

    test "disabling coffee-script wrapper" do
      template = Tilt::CoffeeScriptTemplate.new(:no_wrap => true) { |t| "puts 'Hello, World!'\n" }
      assert_equal "puts('Hello, World!');", template.render
    end
  end

rescue LoadError => boom
  warn "Tilt::CoffeeScriptTemplate (disabled)\n"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tilt-1.2.1 test/tilt_coffeescripttemplate_test.rb
tilt-1.2 test/tilt_coffeescripttemplate_test.rb