Sha256: 01c2fbdb13cf53a3c33b0913801a131722921bbf681e2f2525d22976a7e0f00c
Contents?: true
Size: 858 Bytes
Versions: 26
Compression:
Stored size: 858 Bytes
Contents
# Run from your Rails main directory require 'test/test_helper' class TestHaml < Test::Unit::TestCase def setup @base = ActionView::Base.new end def assert_haml_renders(expected, input) actual = Haml::Engine.new(input).to_html(@base) assert_equal expected, actual end def test_haml_engine assert_haml_renders <<OUT, <<IN A & B C & D E & F G & H I & J OUT A & B = "C & D" = h("E & F") = "G & H".mark_as_xss_protected = "I & J".to_s_xss_protected IN end def test_attribute_escaping_in_haml @base.instance_eval { @foo = "A < & > ' \" B" } assert_haml_renders <<OUT, <<IN <div foo="A < & > ' " B" /> <div foo="A < & > ' " B" /> OUT %div{:foo => @foo}/ %div{:foo => @foo.mark_as_xss_protected}/ IN # Note that '/" explicitly marked as XSS-protected can break validity end end
Version data entries
26 entries across 26 versions & 5 rubygems