Permalink
Browse files

Merge pull request #6380 from nashby/output-safety-interpolation

doesn't modify params in SafeBuffer#%
  • Loading branch information...
josevalim committed May 18, 2012
2 parents 1ae68ea + 3b1c30c commit fa561a537d5188d09fcc47e257378e953df4858e
@@ -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 fa561a5

Please sign in to comment.