Permalink
Browse files

error/index.js

  • Loading branch information...
1 parent 13c18fa commit 9719b585754e6a6a1255416da78a9924f0eedc96 @tj tj committed Apr 26, 2012
Showing with 28 additions and 26 deletions.
  1. 0 examples/error/{app.js → index.js}
  2. +26 −25 test/acceptance/error-pages.js
  3. +2 −1 test/acceptance/error.js
File renamed without changes.
@@ -1,37 +1,38 @@
+
var app = require('../../examples/error-pages')
, request = require('../support/http');
describe('error-pages', function(){
describe('GET /', function(){
it('should respond with page list', function(done){
request(app)
- .get('/')
- .expect(/Pages Example/,done)
+ .get('/')
+ .expect(/Pages Example/, done)
})
})
describe('Accept: text/html',function(){
describe('GET /403', function(){
it('should respond with 403', function(done){
request(app)
- .get('/403')
- .expect(403,done)
+ .get('/403')
+ .expect(403, done)
})
})
describe('GET /404', function(){
it('should respond with 404', function(done){
request(app)
- .get('/404')
- .expect(404,done)
+ .get('/404')
+ .expect(404, done)
})
})
describe('GET /500', function(){
it('should respond with 500', function(done){
request(app)
- .get('/500')
- .expect(500,done)
+ .get('/500')
+ .expect(500, done)
})
})
})
@@ -41,31 +42,31 @@ describe('error-pages', function(){
describe('GET /403', function(){
it('should respond with 403', function(done){
request(app)
- .get('/403')
- .set('Accept','application/json')
- .expect(403,done)
+ .get('/403')
+ .set('Accept','application/json')
+ .expect(403, done)
})
})
describe('GET /404', function(){
it('should respond with 404', function(done){
request(app)
- .get('/404')
- .set('Accept','application/json')
- .end(function(res){
- res.should.have.property('statusCode',200)
- res.should.have.property('body',JSON.stringify({error:'Not found'}))
- done()
- })
+ .get('/404')
+ .set('Accept','application/json')
+ .end(function(res){
+ res.should.have.property('statusCode',200)
+ res.should.have.property('body',JSON.stringify({error:'Not found'}))
+ done()
+ })
})
})
describe('GET /500', function(){
it('should respond with 500', function(done){
request(app)
- .get('/500')
- .set('Accept','application/json')
- .expect(500,done)
+ .get('/500')
+ .set('Accept','application/json')
+ .expect(500, done)
})
})
})
@@ -77,7 +78,7 @@ describe('error-pages', function(){
request(app)
.get('/403')
.set('Accept','text/plain')
- .expect(403,done)
+ .expect(403, done)
})
})
@@ -97,9 +98,9 @@ describe('error-pages', function(){
describe('GET /500', function(){
it('should respond with 500', function(done){
request(app)
- .get('/500')
- .set('Accept','text/plain')
- .expect(500,done)
+ .get('/500')
+ .set('Accept','text/plain')
+ .expect(500, done)
})
})
})
View
@@ -1,4 +1,5 @@
-var app = require('../../examples/error/app')
+
+var app = require('../../examples/error')
, request = require('../support/http');
describe('error', function(){

0 comments on commit 9719b58

Please sign in to comment.