don't need to rescue Exception in this case
This commit is contained in:
parent
ff18049ca6
commit
5eaeb37080
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user