Sha256: 2d274ba8632d99bd63cb3892b9fec00621a29d62714d80ce893da58c5073a206
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') describe EscapeUtils, "unescape_html" do it "should respond to unescape_html" do EscapeUtils.should respond_to(:unescape_html) end it "should unescape a basic html tag" do EscapeUtils.unescape_html("<some_tag/>").should eql("<some_tag/>") end it "should unescape double-quotes" do EscapeUtils.unescape_html("<some_tag some_attr="some value"/>").should eql("<some_tag some_attr=\"some value\"/>") end it "should unescape single-quotes" do EscapeUtils.unescape_html("<some_tag some_attr='some value'/>").should eql("<some_tag some_attr='some value'/>") end it "should unescape the & character" do EscapeUtils.unescape_html("<b>Bourbon & Branch</b>").should eql("<b>Bourbon & Branch</b>") end it "should pass through incompletely escaped tags" do EscapeUtils.unescape_html("&").should eql("&") EscapeUtils.unescape_html("<").should eql("<") end if RUBY_VERSION =~ /^1.9/ it "return value should be in original string's encoding" do str = "<b>Bourbon & Branch</b>".encode('us-ascii') EscapeUtils.unescape_html(str).encoding.should eql(Encoding.find('us-ascii')) str = "<b>Bourbon & Branch</b>".encode('utf-8') EscapeUtils.unescape_html(str).encoding.should eql(Encoding.find('utf-8')) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
escape_utils-0.2.4 | spec/html/unescape_spec.rb |