Created
September 20, 2012 23:54
-
-
Save fivetanley/3759016 to your computer and use it in GitHub Desktop.
support file for mocha tests
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
// requirejs global - hm.... | |
define( function( require ) { | |
var support = require( 'support' ) | |
// chai js loaded with sinon-chai and chai-jquery | |
, expect = support.expect | |
// sinon.js stub function. I also have spy and mock functions available | |
// on the support object | |
, stub = support.stub | |
, REPL = require( 'models/repl' ) | |
// Nope, I was wrong. "describe" and "it" functions are in the global scope... | |
describe( 'REPL', function() { | |
beforeEach( function() { | |
this.repl = new REPL() | |
}) | |
describe( 'evaluating input', function() { | |
it( 'returns the evaluated input', function() { | |
expect( this.repl.$eval( '2+2' ) ).to.equal( 4 ) | |
}) | |
}) | |
}) | |
}); |
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
define( function( require ) { | |
var sinon = require( 'sinon' ) | |
, sinonChai = require( 'sinon_chai' ) | |
, jquery = require( 'jquery' ) | |
, chai = require( 'chai' ) | |
, chaiJquery = require( 'chai_jquery' ) | |
, relief = require( 'relief' ) | |
, expect | |
chai.use( sinonChai ) | |
chai.use( chaiJquery ) | |
expect = chai.expect | |
return { | |
sinon: sinon | |
, $: jquery | |
, expect: expect | |
, stub: sinon.stub | |
, spy: sinon.spy | |
, mock: sinon.mock | |
, relief: relief | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment