Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View 1.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
describe("an async spec", function(){
 
beforeEach(function(){
var done = false;
 
function doStuff(){
// simulate async stuff and wait 10ms
setTimeout(function(){
done = true;
}, 10);
}
 
runs(doStuff);
 
waitsFor(function(){
return done;
});
});
 
it("did stuff", function(){
expect(done).toBe(true);
});
 
});
View 1.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
describe("an async spec", function(){
 
var foo = false,
async = new AsyncSpec(this);
 
async.beforeEach(function(done){
 
// simulate async stuff and wait 10ms
setTimeout(function(){
foo = true;
done();
}, 10);
 
});
 
it("did stuff", function(){
expect(foo).toBe(true);
});
 
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.