Sha256: 0e209ce56402ecaabf642cae2d22edb16b56a92b5cd01ee411e2a5bb9ae2fc9e
Contents?: true
Size: 1.39 KB
Versions: 7
Compression:
Stored size: 1.39 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
7 entries across 7 versions & 1 rubygems