Sha256: df834ce0264d3dcdcfa44463de0c6e4fc17b40825ed2327faf90392b1c2fa332
Contents?: true
Size: 1.38 KB
Versions: 6
Compression:
Stored size: 1.38 KB
Contents
require 'helper' class TestSkimCodeEscaping < TestSkim def test_escaping_evil_method source = %q{ p = @evil_method() } assert_html '<p><script>do_something_evil();</script></p>', source end def test_render_unsafe source = %q{ p = "<strong>Hello World\\n, meet \\"Skim\\"</strong>." } assert_html "<p><strong>Hello World\n, meet \"Skim\"</strong>.</p>", source end def test_render_safe source = %q{ p = @safe("<strong>Hello World\\n, meet \\"Skim\\"</strong>.") } assert_html "<p><strong>Hello World\n, meet \"Skim\"</strong>.</p>", source end def test_render_with_disable_escape_false source = %q{ = "<p>Hello</p>" == "<p>World</p>" } assert_html "<p>Hello</p><p>World</p>", source end def test_render_with_disable_escape_true source = %q{ = "<p>Hello</p>" == "<p>World</p>" } assert_html "<p>Hello</p><p>World</p>", source, :disable_escape => true end def test_explicit_escape source = %q{ = @escape "Crate & Barrel" } assert_html "Crate & Barrel", source end def test_explicit_safe source = %q{ = @safe "Crate & Barrel" } assert_html "Crate & Barrel", source end def test_user_defined_escape source = %q{ = "Crate & Barrel" } assert_html "CRATE & BARREL", source, :context => "{escape: function (value) { return value.toUpperCase(); }}" end end
Version data entries
6 entries across 6 versions & 1 rubygems