Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (21 sloc) 0.831 kb
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
Jump to Line
Something went wrong with that request. Please try again.