aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-03-05 15:19:44 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2015-03-05 15:19:44 -0800
commit5eaeb3708059aa23ed1c250219082c508e58c6e5 (patch)
tree758359b4f2d07f0ad485ed5ccb5883d5231fe343 /actionview
parentff18049ca6f27deb7e7f955478e1464f8d756332 (diff)
downloadrails-5eaeb3708059aa23ed1c250219082c508e58c6e5.tar.gz
rails-5eaeb3708059aa23ed1c250219082c508e58c6e5.tar.bz2
rails-5eaeb3708059aa23ed1c250219082c508e58c6e5.zip
don't need to rescue Exception in this case
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/helpers/debug_helper.rb2
-rw-r--r--actionview/test/activerecord/debug_helper_test.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/debug_helper.rb b/actionview/lib/action_view/helpers/debug_helper.rb
index ba47eee9ba..e9dccbad1c 100644
--- a/actionview/lib/action_view/helpers/debug_helper.rb
+++ b/actionview/lib/action_view/helpers/debug_helper.rb
@@ -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
diff --git a/actionview/test/activerecord/debug_helper_test.rb b/actionview/test/activerecord/debug_helper_test.rb
index 5609694cd5..03cb1d5a91 100644
--- a/actionview/test/activerecord/debug_helper_test.rb
+++ b/actionview/test/activerecord/debug_helper_test.rb
@@ -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