Closed limfinity closed 7 years ago
I think you're just going to have to stub those methods. It would be a bad idea for Kiwi to try and keep track of selectors to avoid, as they change per-OS ( as you've found ) and sometimes you might want to realistically test for an underscore'd method.
One thing you could do - is make a library that generally mocks out classes with the known private internals like this, I've co-done this with a library for OCMock
Thanks @orta! I stubbed the methods manually as you suggested.
Precondition: Using Bolts framework and async testing;
applicationMock
is a partially mocked object of UIApplicationWhat I do:
[UIApplication stub:@selector(sharedApplication) andReturn:applicationMock];
Then I test to open URLs on that mocked objectWhat I expect: Test runs without errors
What I receive: Test fails because of unrecognized selector sent to instance of my custom UIApplication mock class.
Reason: The selector name is
_isClassic
testing on iOS 10 with Xcode 8 but I've also seendisplayIdentifier
when testing on iOS 9 with Xcode 8.Proposed solution: Maybe adding methods starting with an underscore to the whitelist might help.
I'm glad to hear from anybody having similar problems. :)