Created
February 17, 2014 09:28
-
-
Save johanforssell/9047487 to your computer and use it in GitHub Desktop.
Helpful trio of macros to make sure your asynchronous blocks are run in a Kiwi spec file.
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 characters
#pragma mark - Kiwi Blocks rally | |
// 1/3: Invoke at start of test | |
#define BlocksRallyStart(_a) \ | |
NSInteger _blocks_total = _a; __block NSInteger _blocks_counter = 0; | |
// 2/3: Invoke in each block you're waiting for | |
#define BlocksRallyCheckpoint \ | |
_blocks_counter += 1; | |
// 3/3: Invoke last in test | |
#define BlocksRallyFinishLine \ | |
[[expectFutureValue(theValue(_blocks_counter)) shouldEventuallyBeforeTimingOutAfter(2)] equal:theValue(_blocks_total)]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment