summaryrefslogtreecommitdiff
path: root/spec/functions/uriescape_spec.rb
diff options
context:
space:
mode:
authorBryon Roché <kain@kain.org>2014-08-08 16:59:37 -0700
committerMorgan Haskel <morgan@puppetlabs.com>2015-03-03 16:05:47 -0800
commit41baef8502eabd34dc4fe49f43c6ef7c61f8e6c3 (patch)
tree9b5cd020602d8260bd4215881349260e20d5a026 /spec/functions/uriescape_spec.rb
parent055083c117f79e03e7313f328f9e3e338d4dc6a9 (diff)
URI.escape for the array case was incorrect.
The previous commit to uriescape() changed the implementation to use the ruby default escape list for URI.escape(), but did not change the call triggered when uriescape() was called on an array, triggering ruby errors.
Diffstat (limited to 'spec/functions/uriescape_spec.rb')
-rwxr-xr-xspec/functions/uriescape_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/functions/uriescape_spec.rb b/spec/functions/uriescape_spec.rb
index 2321e5a..d0f37de 100755
--- a/spec/functions/uriescape_spec.rb
+++ b/spec/functions/uriescape_spec.rb
@@ -17,6 +17,13 @@ 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'))