forked from exceptional/exceptional
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wal
committed
Aug 17, 2010
1 parent
62ca98c
commit b2c8fa6
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require File.dirname(__FILE__) + '/../spec_helper' | ||
require 'digest/md5' | ||
|
||
|
||
class Exceptional::FunkyError < StandardError | ||
def backtrace | ||
'backtrace' | ||
end | ||
end | ||
|
||
class BrokenJSON | ||
def to_json | ||
boom.time! | ||
end | ||
end | ||
|
||
describe Exceptional::ControllerExceptionData do | ||
it "raises useful error when to_json isn't available on to_hash" do | ||
request = ActionController::TestRequest.new | ||
brokenJson = BrokenJSON.new | ||
session = {:boom => brokenJson} | ||
request.stub!(:session).and_return(session) | ||
data = Exceptional::ControllerExceptionData.new(Exceptional::FunkyError.new, nil, request) | ||
JSON.parse(data.to_json)['request']['session']['data'].should == {"boom" => brokenJson.to_s} | ||
end | ||
end |