Sha256: 2d922444f35b9a1fad0f404d7010c908eb8f5d59ac4b8a10afefa4426ee3c556

Contents?: true

Size: 1.17 KB

Versions: 76

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'
require 'tilt'
require 'tilt/sigil'

system('sigil -v')

if $?.success?
  class SigilTemplateTest < Minitest::Test
    test "registered for '.sigil' files" do
      assert_equal Tilt::SigilTemplate, Tilt['test.sigil']
    end

    test "loading and evaluating templates on #render" do
      template = Tilt::SigilTemplate.new { |t| "Hello World!" }
      assert_equal "Hello World!", template.render
    end

    test "can be rendered more than once" do
      template = Tilt::SigilTemplate.new { |t| "Hello World!" }
      3.times { assert_equal "Hello World!", template.render }
    end

    test "passing locals" do
      template = Tilt::SigilTemplate.new { 'Hey $name!' }
      assert_equal "Hey Joe!", template.render(Object.new, :name => 'Joe')
    end

    test "error message" do
      template = Tilt::SigilTemplate.new('test.sigil') { '{{undef_func}}' }
      begin
        template.render
        fail 'should have raised an exception'
      rescue => boom
        assert_kind_of RuntimeError, boom
        assert_equal 'template: test.sigil:1: function "undef_func" not defined', boom.message
      end
    end
  end
else
  warn "Tilt::SigilTemplate (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_sigil_test.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/tilt-2.0.9/test/tilt_sigil_test.rb