Created
January 18, 2015 02:29
-
-
Save themindfuldev/587553f71515682d81f7 to your computer and use it in GitHub Desktop.
jasmine-precondition
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
describe('the preCondition instruction', function () { | |
var counter1 = 0, | |
counter2 = 0, | |
interval; | |
beforeEach(function(done) { | |
interval = setInterval(function(){ | |
counter1 += 100; | |
}, 100); | |
preCondition(function() { | |
return counter1 >= 500; | |
}, done, 100); | |
}); | |
it('should only get executed when counter1 is 500', function (done) { | |
expect(counter1).toBe(500); | |
preCondition(function() { | |
counter2 += 200; | |
return counter2 === 1000; | |
}, done, 100); | |
}); | |
it('should only get executed when counter2 is 1000', function () { | |
expect(counter2).toBe(1000); | |
}); | |
afterEach(function(){ | |
clearInterval(interval); | |
}); | |
}); |
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
preCondition(condition, done, interval); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment