Permalink
Browse files

doesn't modify params in SafeBuffer#%

  • Loading branch information...
nashby committed May 18, 2012
1 parent 62c6ac2 commit 3b1c30c99ff1f3f5e970e3fa696d3291d5897bd7
@@ -151,9 +151,7 @@ def +(other)
end
def %(args)
- args = Array(args)
-
- args.map! do |arg|
+ args = Array(args).map do |arg|
if !html_safe? || arg.html_safe?
arg
else
@@ -463,6 +463,13 @@ def to_s
assert @other_string.html_safe?
end
+ test "Concatting with % doesn't modify a string" do
+ @other_string = ["<p>", "<b>", "<h1>"]
+ "%s %s %s".html_safe % @other_string
+
+ assert_equal ["<p>", "<b>", "<h1>"], @other_string
+ end
+
test "Concatting a fixnum to safe always yields safe" do
string = @string.html_safe
string = string.concat(13)

0 comments on commit 3b1c30c

Please sign in to comment.