似乎 octest 不会减少在测试中创建的实例的引用计数
- (void)test_That_TaskFetcher_is_Invoked_from_tasksDownloaded {
InboxViewController *vc = [[InboxViewController alloc] init];
id fetcher = [OCMockObject mockForClass:[TaskFetcher class]];
[vc setTaskFetcher:fetcher];
[[fetcher expect] fetchTasksfromManagedObjectContext:OCMOCK_ANY
withPredicate:OCMOCK_ANY
WithBlockForEachTask:OCMOCK_ANY
WithFailureBlock:OCMOCK_ANY
WithNoResultsBlock:OCMOCK_ANY
WithCompletionBlock:OCMOCK_ANY];
[vc tasksDownloaded];
STVerify(fetcher);
}
vc 上有一个 [NSNotificationCenter defaultcenter] 监听器。此 vc 实例上的侦听器正在从其他测试中调用。
为什么???