diff options
Diffstat (limited to 'spec/functions/uriescape_spec.rb')
-rwxr-xr-x | spec/functions/uriescape_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/functions/uriescape_spec.rb b/spec/functions/uriescape_spec.rb index c44e9c1..d0f37de 100755 --- a/spec/functions/uriescape_spec.rb +++ b/spec/functions/uriescape_spec.rb @@ -17,8 +17,24 @@ describe "the uriescape function" do expect(result).to(eq(':/?%23[]@!$&\'()*+,;=%20%22%7B%7D')) end + it "should uriescape an array of strings, while not touching up nonstrings" do + teststring = ":/?#[]@!$&'()*+,;= \"{}" + expectstring = ':/?%23[]@!$&\'()*+,;=%20%22%7B%7D' + result = scope.function_uriescape([[teststring, teststring, 1]]) + expect(result).to(eq([expectstring, expectstring, 1])) + end + it "should do nothing if a string is already safe" do result = scope.function_uriescape(["ABCdef"]) expect(result).to(eq('ABCdef')) end + + it "should accept objects which extend String" do + class AlsoString < String + end + + value = AlsoString.new('abc') + result = scope.function_uriescape([value]) + result.should(eq('abc')) + end end |