summaryrefslogtreecommitdiff
path: root/spec/ruby/library/cgi/unescapeHTML_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/cgi/unescapeHTML_spec.rb')
-rw-r--r--spec/ruby/library/cgi/unescapeHTML_spec.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/ruby/library/cgi/unescapeHTML_spec.rb b/spec/ruby/library/cgi/unescapeHTML_spec.rb
index 46387d4f01..e43dcc83e5 100644
--- a/spec/ruby/library/cgi/unescapeHTML_spec.rb
+++ b/spec/ruby/library/cgi/unescapeHTML_spec.rb
@@ -1,5 +1,9 @@
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
describe "CGI.unescapeHTML" do
it "unescapes '&amp; &lt; &gt; &quot;' to '& < > \"'" do
@@ -36,4 +40,9 @@ describe "CGI.unescapeHTML" do
input = "fooooooo&#"
CGI.unescapeHTML(input).should == input
end
+
+ it "unescapes invalid encoding" do
+ input = "\xFF&"
+ CGI.unescapeHTML(input).should == input
+ end
end