# -*- coding: utf-8 -*- $LOAD_PATH.unshift File.dirname(__FILE__) require 'helper' class MustacheTest < Test::Unit::TestCase def test_instance_render klass = Class.new(Mustache) klass.template = "Hi {{thing}}!" assert_equal "Hi world!", klass.render(:thing => :world) assert_equal "Nice.", klass.render("{{compliment}}.", :compliment => "Nice") assert_equal <<-end_simple, Simple.new.render(:name => "yo", :in_ca => false) Hello yo You have just won $10000! end_simple end def test_passenger assert_equal <<-end_passenger, Passenger.to_text ServerName example.com DocumentRoot /var/www/example.com RailsEnv production end_passenger end def test_complex_view assert_equal <<-end_complex, ComplexView.render

Colors

end_complex end def test_nested_objects assert_equal <<-end_complex, NestedObjects.render

Colors

end_complex end def test_single_line_sections html = %(

) instance = Mustache.new instance.template = html instance[:no_flash] = true assert_equal %Q'

) instance = Mustache.new instance.template = html instance[:no_flash] = true assert_equal %Q'