Sha256: 20d585a42a11be489c85ce8ed16910f6cb5b72997b8a8c8aad3c427e4f93f691
Contents?: true
Size: 584 Bytes
Versions: 20
Compression:
Stored size: 584 Bytes
Contents
require 'spec_helper' describe "Riddle" do it "should escape characters correctly" do invalid_chars = ['(', ')', '|', '-', '!', '@', '~', '"', '/'] invalid_chars.each do |char| base = "string with '#{char}' character" Riddle.escape(base).should == base.gsub(char, "\\#{char}") end # Not sure why this doesn't work within the loop... Riddle.escape("string with & character").should == "string with \\& character" all_chars = invalid_chars.join('') + '&' Riddle.escape(all_chars).should == "\\(\\)\\|\\-\\!\\@\\~\\\"\\/\\&" end end
Version data entries
20 entries across 20 versions & 1 rubygems