Run second waitFor in runs() block

It seems that this is more reliable way to handle async waits. runs
block is executed only when first waitFor succeeds and then it waits for
next waitFor.
This commit is contained in:
Piotr Sarnacki 2012-07-30 13:25:30 +02:00
parent a3c4468b5a
commit 4a15ccde32
2 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,8 @@ describe 'on the "build" state', ->
beforeEach ->
app 'travis-ci/travis-core/builds/1'
waitFor reposRendered
waitFor buildRendered
runs ->
waitFor buildRendered
afterEach ->
window.history.pushState({}, null, '/spec.html')

View File

@ -4,7 +4,9 @@
beforeEach(function() {
app('travis-ci/travis-core/builds/1');
waitFor(reposRendered);
return waitFor(buildRendered);
return runs(function() {
return waitFor(buildRendered);
});
});
afterEach(function() {
return window.history.pushState({}, null, '/spec.html');