File tree Expand file tree Collapse file tree 3 files changed +17
-20
lines changed Expand file tree Collapse file tree 3 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,7 @@ def call(env)
5959 raise
6060 end
6161
62- error = env [ 'rack.exception' ] || env [ 'sinatra.error' ] || env [ 'action_dispatch.exception' ]
63-
62+ error = env [ 'rack.exception' ] || env [ 'sinatra.error' ]
6463 Raven ::Rack . capture_exception ( error , env ) if error
6564
6665 response
Original file line number Diff line number Diff line change 4646 stack . call ( env )
4747 end
4848
49- it 'should capture rails errors when ActionDispatch::ShowExceptions is enabled' do
50- exception = build_exception
51- env = { }
52-
53- expect ( Raven ::Rack ) . to receive ( :capture_exception ) . with ( exception , env )
54-
55- app = lambda do |e |
56- e [ 'action_dispatch.exception' ] = exception
57- [ 200 , { } , [ 'okay' ] ]
58- end
59-
60- stack = Raven ::Rack . new ( app )
61-
62- stack . call ( env )
63- end
64-
6549 it 'should clear context after app is called' do
6650 Raven ::Context . current . tags [ :environment ] = :test
6751
Original file line number Diff line number Diff line change 88 config . dsn = 'dummy://notaserver'
99 config . encoding = 'json'
1010 end
11-
11+ Rails . env = "production"
1212 TestApp . initialize!
1313 end
1414
15+ after ( :each ) do
16+ Raven . client . transport . events = [ ]
17+ end
18+
1519 it "inserts middleware" do
1620 expect ( TestApp . middleware ) . to include ( Raven ::Rack )
1721 end
1822
19- pending "should capture exceptions" do
23+ it "should capture exceptions in production " do
2024 get "/exception"
2125 expect ( response . status ) . to eq ( 500 )
2226 expect ( Raven . client . transport . events . size ) . to eq ( 1 )
2327 end
28+
29+ it "should properly set the exception's URL" do
30+ get "/exception"
31+
32+ # TODO: dummy transport shouldn't even encode the event
33+ event = Raven . client . transport . events . first
34+ event = JSON . parse! ( event [ 1 ] )
35+
36+ expect ( event [ 'request' ] [ 'url' ] ) . to eq ( "http://www.example.com/exception" )
37+ end
2438end
You can’t perform that action at this time.
0 commit comments