Skip to content

Commit

Permalink
non added test from last merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Wal committed Aug 17, 2010
1 parent 62ca98c commit b2c8fa6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/exceptional/controller_exception_data_spec.rb
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

0 comments on commit b2c8fa6

Please sign in to comment.