Skip to content
Myr

Added specs for Request#error()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 8c5f7df · Browse files · 1 file+40 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+40 added−0 removed

  • tests:+40 added−0 removed

1 file+40 added−0 removed

modified:spec/spec.request.js+40 added
240 unmodified lines
241 get('/user').body.should.eql 'Supa doopa usa'242 end243 end244 end245 246 describe '#error()'247 describe 'when accepting "html"'248 describe 'with "show exceptions" enabled'249 it 'should render the show-exceptions page'250 disable('throw exceptions')251 enable('show exceptions')252 get('/', function(){253 this.error(new Error('fail!'))254 })255 get('/').body.should.include '<em>500</em> Error: fail!'256 get('/').status.should.eql 500257 end258 end259 260 describe 'when not accepting "html"'261 it 'should render the default 500 status body'262 var headers = { headers: { accept: 'text/plain' }}263 disable('throw exceptions')264 enable('show exceptions')265 get('/', function(){266 this.error(new Error('fail!'))267 })268 get('/', headers).body.should.eql 'Internal Server Error'269 get('/', headers).status.should.eql 500270 end271 end272 end273 274 describe 'with "show exceptions" disabled'275 it 'should render the default 500 status body'276 disable('throw exceptions')277 get('/', function(){278 this.error(new Error('fail!'))279 })280 get('/').body.should.eql 'Internal Server Error'281 get('/').status.should.eql 500282 end283 end284 end285 286 end287end