premosystems/XCAsyncTestCase — pull request #6 by Simulacrotron (2014-05-24 17:24:40+00:00)
Title: Added block based waitForStatus:timeout: method

I added a waitForStatus:timeout:withBlock: method in order to fix an issue that caused tests to timeout when the notify: method got called before waitForStatus:timeout: method for called. The waitForStatus:timeout:withBlock: guarantees that the steps to test are called only *after* the reset of the notified property to NO. It also has a the benefit of making the test more readable since the waitForStatus step wraps the step you're waiting on.
```obj-c
[self waitForStatus:XCTAsyncTestCaseStatusSucceeded timeout:2.0 withBlock:^{
[self blockMethodThatReturnsImmediately:^{
[self notify:XCTAsyncTestCaseStatusSucceeded];
}];
}];
```
I added a set of test cases to show the block version works in all the same places the non-block version does. I've also added new test cases that show where the block version works better. There is a matching test for each that is disabled that shows the same test failing under the non-block version.

I also refactored the code use to wait because it was used in two places, I consolidated into on method. The loopUntil associated object was not needed since the loopUntil date wasn't referred to anywhere outside the method, so I removed it. I also changed the enum to use the NS_ENUM macro which makes things a little cleaner.