Skip to content

Instantly share code, notes, and snippets.

@johanforssell
Created February 17, 2014 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanforssell/9047487 to your computer and use it in GitHub Desktop.
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.
#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