提交 26698fb9 编写于 作者: S Sean Walbran

fix interplay of humanize and html_escape

上级 84fe7b7d
......@@ -117,7 +117,7 @@ def humanize(lower_case_and_underscored_word, options = {})
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
......
......@@ -161,6 +161,10 @@ def test_humanize_without_capitalize
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册