Sha256: fc9e47e626d48b8211a02e14e979c6ea0e072345a8a4191ae88d76e8cf8a46a3

Contents?: true

Size: 1.07 KB

Versions: 76

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'
require 'tilt'

begin
  require 'tilt/livescript'

  class LiveScriptTemplateTest < Minitest::Test
    setup do
      @code_without_variables = "puts 'Hello, World!'\n"
      @renderer = Tilt::LiveScriptTemplate
    end

    test "compiles and evaluates the template on #render" do
      template = @renderer.new { |t| @code_without_variables }
      assert_match "puts('Hello, World!');", template.render
    end

    test "can be rendered more than once" do
      template = @renderer.new { |t| @code_without_variables }
      3.times { assert_match "puts('Hello, World!');", template.render }
    end

    test "supports bare-option" do
      template = @renderer.new(:bare => false) { |t| @code_without_variables }
      assert_match "function", template.render

      template = @renderer.new(:bare => true) { |t| @code_without_variables }
      refute_match "function", template.render
    end

    test "is registered for '.ls' files" do
      assert_equal @renderer, Tilt['test.ls']
    end
  end
rescue LoadError
  warn "Tilt::LiveScriptTemplate (disabled)"
end

Version data entries

76 entries across 75 versions & 14 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_livescripttemplate_test.rb