pivotal-legacy / PivotalCoreKit

Shared library and test code for iOS and macOS projects
http://pivotallabs.com
Other
168 stars 85 forks source link

Clean up UIKit spec output #128

Closed joemasilotti closed 9 years ago

joemasilotti commented 9 years ago

Running UIKit specs logs out assertion failures due to the tests hitting code paths that expectedly fail assertions. Using an NSException achieves the same desired behavior but without the logging noise.

I only changed this one example because the tests trigger this code path. Other NSAsserts in the codebase are not triggered via spec so do not need to be changed.

akitchen commented 9 years ago

Have you considered using NSAssertionHandler? when registered, it will have an opportunity to receive the assertion failure and trigger a spec failure.

https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSAssertionHandler_Class/index.html

akitchen commented 9 years ago

On second thought, this is what is being done in similar situations elsewhere, so your PR helps us be consistent. We can look at assertion handlers later.

thx