Sha256: 88d7950503ceeb9ecc0145fa59c1f29b2c0d505deada9c012df7f23da71bb530
Contents?: true
Size: 881 Bytes
Versions: 9
Compression:
Stored size: 881 Bytes
Contents
# encoding: UTF-8 require File.expand_path(File.dirname(__FILE__) + '/spec_helper.rb') 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 include EscapeUtils::HtmlSafety describe EscapeUtils::HtmlSafety do it "should escape unsafe strings and make them safe" do escaped = _escape_html("<strong>unsafe</strong>") escaped.should eql("<strong>unsafe</strong>") escaped.should be_html_safe end it "shouldn't escape safe strings" do _escape_html("<p>safe string</p>".html_safe).should eql("<p>safe string</p>") end it "should work with non strings" do _escape_html(5).should eql("5") _escape_html(:hello).should eql("hello") end end
Version data entries
9 entries across 9 versions & 1 rubygems