Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save craftgear/782905 to your computer and use it in GitHub Desktop.
Save craftgear/782905 to your computer and use it in GitHub Desktop.
// install "jasmine-node"
// copy "specs.js" file and "lib/" directory to your project directory
// make "spec" dir
// put your spec files in "spec" directory
// run spec "node specs.js"
//an example spec file
var sys, zombie;
zombie = require('zombie');
sys = require('sys');
describe("some controller spec", function() {
it('responds 200 OK', function() {
zombie.visit('http://localhost:3000/', function(err, browser) {
expect(browser.lastResponse.status).toEqual(200);
//This method is a part of jasmine-node
asyncSpecDone();
});
});
it('title should be Node.js Rocks!', function() {
zombie.visit('http://localhost:3000/', function(err, browser) {
expect(browser.text('title')).toEqual('Node.js Rocks!');
//This method is a part of jasmine-node as well.
asyncSpecDone();
});
});
afterEach(function() {
//So is this.
asyncSpecWait();
});
});
//jasmine-node is great. Thanks, authors!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment