1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

doesn't modify params in SafeBuffer#%

This commit is contained in:
Vasiliy Ermolovich 2012-05-18 18:17:43 +03:00
parent 62c6ac2f8d
commit 3b1c30c99f
2 changed files with 8 additions and 3 deletions

View file

@ -151,9 +151,7 @@ module ActiveSupport #:nodoc:
end
def %(args)
args = Array(args)
args.map! do |arg|
args = Array(args).map do |arg|
if !html_safe? || arg.html_safe?
arg
else

View file

@ -463,6 +463,13 @@ class OutputSafetyTest < ActiveSupport::TestCase
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)