Created
May 4, 2013 01:46
-
-
Save colinwren/5515675 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var assert = require('assert'); | |
| var httpHelper = require('./helpers/httpHelper.js'); | |
| var appHelper = require('./helpers/appHelper'); | |
| describe('View routes', function() { | |
| var appName = 'testApp'; | |
| before(function(done) { | |
| appHelper.build(function(err) { | |
| if(err) return done(err); | |
| process.chdir(appName); | |
| done(); | |
| }); | |
| }); | |
| after(function() { | |
| process.chdir('../'); | |
| appHelper.teardown(); | |
| }); | |
| describe('with default routing', function() { | |
| it('should respond to a get request to localhost:1337 with welcome page', function(done) { | |
| httpHelper.testRoute('get', '', function(err, response) { | |
| if (err) done(new Error(err)); | |
| assert(response.body.indexOf('It works!') !== -1); | |
| done(); | |
| }); | |
| }); | |
| }); | |
| describe('with no specified routing', function() { | |
| it('should respond to get request to :controller with the template at views/:controller/index.ejs', function(done) { | |
| httpHelper.testRoute('get', 'empty', function(err, response) { | |
| if (err) done(new Error(err)); | |
| assert(response.body.indexOf('indexView') !== -1); | |
| done(); | |
| }); | |
| }); | |
| it('should respond to get request to :controller/:action with the template at views/:controller/:action.ejs', function(done) { | |
| httpHelper.testRoute('get', 'empty/create', function(err, response) { | |
| if (err) done(new Error(err)); | |
| assert(response.body.indexOf('createView') !== -1); | |
| done(); | |
| }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment