Sha256: 89d3144fbd966b964d548f3d2104f10d5902de5d7aee642aac7cbf6babfcdc25

Contents?: true

Size: 828 Bytes

Versions: 48

Compression:

Stored size: 828 Bytes

Contents

require "rubygems"
require "test/unit"
require "json"
require "haml"

class HamlTest < Test::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(test["haml"], options)
        result           = engine.render(Object.new, locals)

        assert_equal html, result.strip
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.7.1 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.7.0 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.9 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.8 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.7 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.6 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.5 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.4 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.3 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.2 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.1 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.6.0 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.5.17 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.5.16 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.5.15 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb
classiccms-0.5.14 vendor/bundle/gems/haml-3.1.5/test/haml-spec/ruby_haml_test.rb