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:
parent
ff18049ca6
commit
5eaeb37080
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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 a new issue