Sha256: ba3e4b39c13e9911c32bd4b01a64ce2375b351bf7cefd9435e61070c9b40f210

Contents?: true

Size: 831 Bytes

Versions: 38

Compression:

Stored size: 831 Bytes

Contents

require "rubygems"
require "minitest/autorun"
require "json"
require "haml"

class HamlTest < MiniTest::Unit::TestCase
  contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json"))
  contexts.each do |context|
    context[1].each do |name, test|
      define_method("test_spec: #{name} (#{context[0]})") do
        html             = test["html"]
        haml             = test["haml"]
        locals           = Hash[(test["locals"] || {}).map {|x, y| [x.to_sym, y]}]
        options          = Hash[(test["config"] || {}).map {|x, y| [x.to_sym, y]}]
        options[:format] = options[:format].to_sym if options.key?(:format)
        engine           = Haml::Engine.new(haml, options)
        result           = engine.render(Object.new, locals)

        assert_equal html, result.strip
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 7 rubygems

Version Path
brakeman-4.3.1 bundle/ruby/2.5.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.7.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.6.2 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.6.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.6.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.5.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
arcabouco-0.2.13 vendor/bundle/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.4.1 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb
brakeman-3.4.0 bundle/ruby/2.3.0/gems/haml-4.0.7/test/haml-spec/ruby_haml_test.rb