Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ensure #to_hash is called on objects supporting it when cleaning unse…

…rializable data.
  • Loading branch information...
commit 0e68e717b02e504ee5f2424998f56dd087c2de9a 1 parent 4bee32a
Tristan Dunn tristandunn authored
2  lib/hoptoad_notifier.rb
@@ -11,7 +11,7 @@
11 11 # Plugin for applications to automatically post errors to the Hoptoad of their choice.
12 12 module HoptoadNotifier
13 13
14   - VERSION = "2.0.17"
  14 + VERSION = "2.0.18"
15 15 API_VERSION = "2.0"
16 16 LOG_PREFIX = "** [Hoptoad] "
17 17
2  lib/hoptoad_notifier/notice.rb
@@ -221,7 +221,7 @@ def clean_unserializable_data_from(attribute)
221 221 # TODO: move this onto Hash
222 222 def clean_unserializable_data(data)
223 223 if data.respond_to?(:to_hash)
224   - data.inject({}) do |result, (key, value)|
  224 + data.to_hash.inject({}) do |result, (key, value)|
225 225 result.merge(key => clean_unserializable_data(value))
226 226 end
227 227 elsif data.respond_to?(:to_ary)
6 test/notice_test.rb
@@ -297,6 +297,12 @@ def stub_request(attrs = {})
297 297 assert_equal params, notice[:request][:params]
298 298 end
299 299
  300 + should "ensure #to_hash is called on objects that support it" do
  301 + assert_nothing_raised do
  302 + build_notice(:session => { :object => stub(:to_hash => {}) })
  303 + end
  304 + end
  305 +
300 306 def assert_accepts_exception_attribute(attribute, args = {}, &block)
301 307 exception = build_exception
302 308 block ||= lambda { exception.send(attribute) }

0 comments on commit 0e68e71

Please sign in to comment.
Something went wrong with that request. Please try again.