diff options
Diffstat (limited to 'spec/ruby/library/cgi/escapeHTML_spec.rb')
-rw-r--r-- | spec/ruby/library/cgi/escapeHTML_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/library/cgi/escapeHTML_spec.rb b/spec/ruby/library/cgi/escapeHTML_spec.rb new file mode 100644 index 0000000000..a3267db4a1 --- /dev/null +++ b/spec/ruby/library/cgi/escapeHTML_spec.rb @@ -0,0 +1,13 @@ +require File.expand_path('../../../spec_helper', __FILE__) +require 'cgi' + +describe "CGI.escapeHTML" do + it "escapes special HTML characters (&\"<>') in the passed argument" do + CGI.escapeHTML(%[& < > " ']).should == '& < > " '' + end + + it "does not escape any other characters" do + chars = " !\#$%()*+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" + CGI.escapeHTML(chars).should == chars + end +end |