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

don't need to rescue Exception in this case

This commit is contained in:
Aaron Patterson 2015-03-05 15:19:44 -08:00
parent ff18049ca6
commit 5eaeb37080
2 changed files with 7 additions and 1 deletions

View file

@ -26,7 +26,7 @@ module ActionView
Marshal::dump(object)
object = ERB::Util.html_escape(object.to_yaml)
content_tag(:pre, object, :class => "debug_dump")
rescue Exception # errors from Marshal or YAML
rescue # errors from Marshal or YAML
# Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback
content_tag(:code, object.inspect, :class => "debug_dump")
end

View file

@ -1,8 +1,14 @@
require 'active_record_unit'
require 'nokogiri'
class DebugHelperTest < ActionView::TestCase
def test_debug
company = Company.new(name: "firebase")
assert_match "name: firebase", debug(company)
end
def test_debug_with_marshal_error
obj = -> { }
assert_match obj.inspect, Nokogiri.XML(debug(obj)).content
end
end