Created
August 1, 2011 01:58
-
-
Save cpsubrian/1117455 to your computer and use it in GitHub Desktop.
Using tobi with vows.
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 vows = require('vows') | |
, tobi = require('tobi') | |
, port = 80 | |
, host = 'www.google.com'; | |
/** | |
* Topic macro to GET a url. | |
*/ | |
var getUrl = function(url) { | |
return function() { | |
var browser = tobi.createBrowser(port, host); | |
browser.get(url, this.callback.bind(this, null)); | |
} | |
} | |
/** | |
* Sample test. | |
*/ | |
vows.describe('Tobi Test').addBatch({ | |
'A request to the frontpage of google': { | |
topic: getUrl('/'), | |
'should have a status of 200': function(_, res, $){ | |
res.should.have.status(200); | |
}, | |
'should have an image with alt="Google"': function(_, res, $) { | |
$('img[alt="Google"]').should.exist; | |
} | |
} | |
}).export(module); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably should be
$('img[alt="Google"]').length.should.be.equal(1);
or something. I haven't been using vows or tobi lately, but I'm glad people are still finding this example.