airbrake/airbrake — Issue #34: 3.0.5 breaks Airbrake.notify(hash)
Author: msepcot
Created: 2011-11-14 18:00:18+00:00
State: open

[This commit](https://github.com/airbrake/airbrake/commit/477bbb51c99540fe76e60db2e14f2fb624320f54) breaks ```Airbrake.notify``` when called with a hash.

Example:

```
ruby-1.9.2-p180 :001 > require 'airbrake'
=> true
ruby-1.9.2-p180 :002 > Airbrake.notify({})
NoMethodError: undefined method `backtrace' for {}:Hash
from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake/notice.rb:223:in `from_exception'
from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake/notice.rb:208:in `exception_attribute'
from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake/notice.rb:96:in `initialize'
from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake.rb:142:in `new'
from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake.rb:142:in `build_notice_for'
from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake.rb:103:in `notify'
from (irb):2
from /Users/msepcot/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `

'
```

In ```test/notifier_test.rb``` "create and send a notice for a hash" stubs out the ```Airbrake::Notice#new``` which hides the error. In 3.0.4 and below, ```build_notice_for``` only set ```:exception``` when the argument did not respond to a ```to_hash``` call. With 3.0.5, ```:exception``` is always set, which is causing the above error to be raised when the argument is a hash.