Revisions
-
juliocesar revised this gist
Apr 4, 2014 . 1 changed file with 6 additions and 11 deletions.There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,19 @@ describe "Asynchronous specs", -> funcRunInBackground = -> value = 1 wrapFuncRunInBackground = (done) -> # setup for simmulating the async operation, a function run in the background setTimeout -> funcRunInBackground() done() , 3000 value = 0 beforeEach (done) -> wrapFuncRunInBackground done console.log "wrap function returns immediately but value = 1 is set 3 seconds later. value is still " + value it "should support async execution of test preparation", -> expect(value).toBeGreaterThan 0 -
suranyami created this gist
Apr 4, 2014 .There are no files selected for viewing
This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ describe "Asynchronous specs", -> funcRunInBackground = -> value = 1 return wrapFuncRunInBackground = (done) -> # setup for simmulating the async operation, a function run in the background setTimeout (-> funcRunInBackground() done() return ), 3000 return value = 0 beforeEach (done) -> wrapFuncRunInBackground done console.log "wrap function returns immediately but value = 1 is set 3 seconds later. value is still " + value return it "should support async execution of test preparation", -> expect(value).toBeGreaterThan 0 return return This file contains 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ describe("Asynchronous specs", function() { var value = 0; function funcRunInBackground() { value = 1; }; function wrapFuncRunInBackground(done) { // setup for simmulating the async operation, a function run in the background setTimeout(function() { funcRunInBackground(); done(); }, 3000); } beforeEach(function(done) { wrapFuncRunInBackground(done); console.log("wrap function returns immediately but value = 1 is set 3 seconds later. value is still " + value); }); it("should support async execution of test preparation", function() { expect(value).toBeGreaterThan(0); }); });