specta / expecta

A Matcher Framework for Objective-C/Cocoa
MIT License
1.59k stars 158 forks source link

Async testing and beInstanceOf #162

Open aprofromindia opened 9 years ago

aprofromindia commented 9 years ago

Async testing fails with after() fails with the matcher beInstanceOf while equal works, am I missing something - My code here : -

https://github.com/aprofromindia/Airlines-List---Clean-Code/blob/master/Sample%20AppTests/MasterViewControllerSpec.m

dbarden commented 8 years ago

I just fell into this.

The problem is that when the matcher is applied for the first time, the pre-requisite of beInstanceOf is not fullfilled.

And, in the case of the pre-requisite not being fulfilled, it will fail immediately instead of retrying the test, as can be seen around here

I guess it would make sense to re-evaluate the pre-requisite every time the runloop runs. If it fails, treat it as a matcher fail and run keep running it. Does that make sense?