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

Merge pull request #1750 from dmathieu/non_string_methods

Calling unsafe methods which don't return a string shouldn't fail
This commit is contained in:
Xavier Noria 2011-06-22 06:30:56 -07:00
commit 5654f6870a
2 changed files with 6 additions and 2 deletions

View file

@ -137,8 +137,8 @@ module ActiveSupport #:nodoc:
UNSAFE_STRING_METHODS.each do |unsafe_method|
class_eval <<-EOT, __FILE__, __LINE__
def #{unsafe_method}(*args)
super.to_str
def #{unsafe_method}(*args, &block)
to_str.#{unsafe_method}(*args, &block)
end
def #{unsafe_method}!(*args)

View file

@ -104,4 +104,8 @@ class SafeBufferTest < ActiveSupport::TestCase
@buffer.safe_concat "BUSTED"
end
end
test "should not fail if the returned object is not a string" do
assert_kind_of Enumerator, @buffer.gsub(/.*/)
end
end