Sha256: b331f79f7811ad146993bce3e71e41ed667bb814d7512a815a695faebe0e43bc
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 Bytes
Contents
require File.expand_path("../helper", __FILE__) class Object def html_safe? false end end class TestSafeBuffer < String def html_safe? true end def html_safe self end def to_s self end end class String def html_safe TestSafeBuffer.new(self) end end class HtmlEscapeTest < MiniTest::Unit::TestCase include EscapeUtils::HtmlSafety def test_marks_escaped_strings_safe escaped = _escape_html("<strong>unsafe</strong>") assert_equal "<strong>unsafe</strong>", escaped assert escaped.html_safe? end def test_doesnt_escape_safe_strings assert_equal "<p>safe string</p>", _escape_html("<p>safe string</p>".html_safe) end def test_ assert_equal "5", _escape_html(5) assert_equal "hello", _escape_html(:hello) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
escape_utils-0.3.2 | test/html_safety_test.rb |
escape_utils-0.3.1 | test/html_safety_test.rb |
escape_utils-0.3.0 | test/html_safety_test.rb |