Sha256: 3092c32f42d9da75d9d1d2cd158ee47e06df6bfed7e6cc41fe96fb223a83600c
Contents?: true
Size: 848 Bytes
Versions: 2
Compression:
Stored size: 848 Bytes
Contents
# encoding: UTF-8 require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb') describe EscapeUtils, "escape_javascript" do it "should respond to escape_javascript" do EscapeUtils.should respond_to(:escape_javascript) end # these are from the ActionView tests it "should return an empty string if passed nil" do EscapeUtils.escape_javascript(nil).should eql("") end it "should escape quotes and newlines" do EscapeUtils.escape_javascript(%(This "thing" is really\n netos')).should eql(%(This \\"thing\\" is really\\n netos\\')) end it "should escape backslashes" do EscapeUtils.escape_javascript(%(backslash\\test)).should eql(%(backslash\\\\test)) end it "should escape closed html tags" do EscapeUtils.escape_javascript(%(dont </close> tags)).should eql(%(dont <\\/close> tags)) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
escape_utils-0.1.2 | spec/javascript/escape_spec.rb |
escape_utils-0.1.1 | spec/javascript/escape_spec.rb |