-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
PhotosViewControllerTests failed #1
Comments
I've had the same issue. It errors out on the line: UIView *view = photosViewController.view; Giving the error: test failure: -[PhotosViewControllerTests testNibLoading] failed: OCMockObject[UINavigationController]: expected method was not invoked: pushViewController:<OCMBlockConstraint: 0xf7521d0> animated:YES However, the test will run and "pass" if you move these lines: // Trigger view did load:
UIView *view = photosViewController.view;
STAssertNotNil(view, @""); to immediately after the initial creation of the PhotosViewController object. But, being new to objective C and OCMock, I'm not sure if that invalidates the test. Just from the above, it seems at first blush like once the [[mockNavController expect] pushViewController] call is made, the testing framework expects the very next message to photosViewController to cause -pushViewController to be called, and then it errors out when the read of photosViewController.view fails to do that. But I'm still too new to this to feel sure that that's really what's going on. It seems like it would be an awkward limitation on a unit testing framework. |
@phamquy @SpaceButler the issue is caused by -[UINavigationController _didGainChildScrollView] call, the mock object did not provide stub for that method. so the mock object just forward that call, the default implementation of forwarding just throw an exception. |
* Creating partial mock for navigation controller. This closes objcio#1 * Updated ocmock submodule
Just clone the source code, update submodule, and run the test
Note: the app is built and run normally
The text was updated successfully, but these errors were encountered: