Question

Is there some reason my Kiwi unit tests are failing with these two lines:

[[theValue([editAuthorViewController class] == [EditAuthorViewController class]) should] beYes];

[[theValue([editAuthorViewController isKindOfClass:[EditAuthorViewController class]]) should] beYes];

While this line passes?

NSString *classString = NSStringFromClass([editAuthorViewController class]);
[[classString should] equal:@"EditAuthorViewController"];
Was it helpful?

Solution

Turns out there's a Kiwi expression to test this I wasn't aware of.

[[editAuthorViewController should] beKindOfClass:[EditAuthorViewController class]];

This failed initially because my EditAuthorViewController.m file was added to my test target. Since [EditAuthorViewController class] was returning a different pointer when called from inside the test bundle, the comparison failed.

To fix this, I had to remove EditAuthorViewController.m from my Compile Sources in my test target.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top