Permalink
Browse files

fix interplay of humanize and html_escape

  • Loading branch information...
1 parent 84fe7b7 commit 26698fb91d88dca0f860adcb80528d8d3f0f6285 @seanwalbran seanwalbran committed Feb 5, 2014
@@ -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

0 comments on commit 26698fb

Please sign in to comment.