Only thing not working as expected is that the h helper did escape html_safe output, but we can fix that easily…
# make h work the same no matter if a string is safe
# ERB::Util.h(" ".html_safe).should_not == " "
module ERB::Util
def html_escape(s)
s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
end
alias h html_escape
module_function :h
module_function :html_escape
end