Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/9694674 to your computer and use it in GitHub Desktop.
Save miguelmota/9694674 to your computer and use it in GitHub Desktop.
Jasmine async beforeEach()
define('Jasmine' , function () {
beforeEach(function(){
runs(function () {
getRemoteData(function(res){
this.data = res;
}.bind(this));
});
waitsFor(function() {
return !!this.data;
}.bind(this), 'Timed out', 1000);
});
it('test', function() {
runs(function() {
expect(this.data).toBe('foo');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment