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

@ -26,7 +26,7 @@ def debug(object)
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

@ -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