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

fix interplay of humanize and html_escape

This commit is contained in:
Sean Walbran 2014-02-05 17:19:51 -06:00
parent 84fe7b7db6
commit 26698fb91d
2 changed files with 5 additions and 1 deletions

View file

@ -117,7 +117,7 @@ module ActiveSupport
result.gsub!(/([a-z\d]*)/i) { |match|
"#{inflections.acronyms[match] || match.downcase}"
}
result.gsub!(/^\w/) { $&.upcase } if options.fetch(:capitalize, true)
result.gsub!(/^\w/) { |match| match.upcase } if options.fetch(:capitalize, true)
result
end

View file

@ -161,6 +161,10 @@ class StringInflectionsTest < ActiveSupport::TestCase
end
end
def test_humanize_with_html_escape
assert_equal 'Hello', ERB::Util.html_escape("hello").humanize
end
def test_ord
assert_equal 97, 'a'.ord
assert_equal 97, 'abc'.ord